Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340373

Summary: Error dialog after toggling "Show Whitespace characters"
Product: [Eclipse Project] Platform Reporter: Andrey Loskutov <loskutov>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Andrey Loskutov CLA 2011-03-17 16:57:41 EDT
Build Identifier: 3.7.0  I20110310-1119 (M6)

java.lang.IllegalArgumentException: Argument cannot be null
	at org.eclipse.swt.SWT.error(SWT.java:4258)
	at org.eclipse.swt.SWT.error(SWT.java:4192)
	at org.eclipse.swt.SWT.error(SWT.java:4163)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:156)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:125)
	at org.eclipse.jface.text.WhitespaceCharacterPainter.<init>(WhitespaceCharacterPainter.java:90)
	at org.eclipse.jface.text.WhitespaceCharacterPainter.<init>(WhitespaceCharacterPainter.java:118)
	at org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction.installPainter(ShowWhitespaceCharactersAction.java:119)
	at org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction.togglePainterState(ShowWhitespaceCharactersAction.java:192)
	at org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction.synchronizeWithPreference(ShowWhitespaceCharactersAction.java:178)
	at org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction.update(ShowWhitespaceCharactersAction.java:106)
	at org.eclipse.ui.texteditor.AbstractTextEditor.handlePreferenceStoreChanged(AbstractTextEditor.java:4658)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.handlePreferenceStoreChanged(AbstractDecoratedTextEditor.java:875)
	at org.eclipse.ui.editors.text.TextEditor.handlePreferenceStoreChanged(TextEditor.java:218)
	at tk.eclipse.plugin.htmleditor.editors.HTMLSourceEditor.handlePreferenceStoreChanged(HTMLSourceEditor.java:216)
	at org.eclipse.ui.texteditor.AbstractTextEditor$PropertyChangeListener.propertyChange(AbstractTextEditor.java:710)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore.firePropertyChangeEvent(ChainedPreferenceStore.java:164)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:431)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore.access$0(ChainedPreferenceStore.java:408)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:69)
	at org.eclipse.ui.preferences.ScopedPreferenceStore$3.run(ScopedPreferenceStore.java:375)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:372)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.setValue(ScopedPreferenceStore.java:813)
	at org.eclipse.ui.texteditor.ShowWhitespaceCharactersAction.run(ShowWhitespaceCharactersAction.java:98)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:230)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:234)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3568)

Reproducible: Always

Steps to Reproduce:
1. Open Java or default text editor
2. Click on "Show whitespace characters" button
3. Enjoy the error dialog
Comment 1 Dani Megert CLA 2011-03-18 03:28:40 EDT
> 3. Enjoy the error dialog
Maybe the provider of the HTMLSourceEditor has more fun with this ;-)

The problem is in 
tk.eclipse.plugin.htmleditor.editors.HTMLSourceEditor.handlePreferenceStoreChanged(HTMLSourceEditor.java:216)

It looks like this editor doesn't remove its listeners upon close/dispose.
Comment 2 Andrey Loskutov CLA 2011-03-18 03:48:36 EDT
(In reply to comment #1)
> The problem is in 
> tk.eclipse.plugin.htmleditor.editors.HTMLSourceEditor

I'm very sorry, I've overseen this line.
Comment 3 Dani Megert CLA 2011-03-18 03:51:03 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > The problem is in 
> > tk.eclipse.plugin.htmleditor.editors.HTMLSourceEditor
> 
> I'm very sorry, I've overseen this line.

np.