Bug 484506 - Form widgets trying to use disposed colors when switching themes
Summary: Form widgets trying to use disposed colors when switching themes
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 critical (vote)
Target Milestone: 4.7 M7   Edit
Assignee: Ralf Petter CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 510777 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-16 12:00 EST by Elena Laskavaia CLA
Modified: 2017-04-05 07:40 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elena Laskavaia CLA 2015-12-16 12:00:43 EST
If I try to switch Theme to Dark and back to GTK I get multiples of this stack trace indicating that some forms colors are disposed inproperly

java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4484)
	at org.eclipse.swt.SWT.error(SWT.java:4418)
	at org.eclipse.swt.SWT.error(SWT.java:4389)
	at org.eclipse.swt.graphics.GC.setForeground(GC.java:3514)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.onPaint(FormHeading.java:851)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.access$10(FormHeading.java:825)
	at org.eclipse.ui.internal.forms.widgets.FormHeading$1.handleEvent(FormHeading.java:584)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4482)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1353)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1338)
	at org.eclipse.swt.widgets.Control.gtk_expose_event(Control.java:3266)
	at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:752)
	at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:181)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1973)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5618)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4718)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9439)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1225)
	at org.eclipse.swt.internal.gtk.OS._gdk_window_process_all_updates(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_window_process_all_updates(OS.java:6029)
	at org.eclipse.swt.widgets.Display.update(Display.java:4670)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211)
	at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:63)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:564)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:396)
	at org.eclipse.jface.action.ActionContributionItem$$Lambda$42/1491862772.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4482)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3820)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3431)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1132)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1023)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:157)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:651)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:595)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
...

I am running neon M4, and I have PDE manifest editor editor open when I do that
Comment 1 Thomas Wolf CLA 2016-09-21 16:08:54 EDT
Happens to me on OS X in both Neon and Neon.1.

Switch from Mac theme to Dark theme works (bar minor glitches), but then a switch back to the Mac theme fails big time. 

Set to "critical" for two reasons:

1. when that happens, one needs to shut down Eclipse right away. Clicks in
   any views may lead to a UI block (infinite spinning cursor).

2. This happens with the EGit staging view open. Since EGit uses the staging
   view as the default and preferred means to commit, more users may have it
   open and thus experience this really nasty behavior.
Comment 2 Andrey Loskutov CLA 2016-09-21 16:23:50 EDT
(In reply to Thomas Wolf from comment #1)
> Happens to me on OS X in both Neon and Neon.1.
> 
> Switch from Mac theme to Dark theme works (bar minor glitches), but then a
> switch back to the Mac theme fails big time.

Same stack trace?
Comment 3 Thomas Wolf CLA 2016-09-21 16:45:41 EDT
(In reply to Andrey Loskutov from comment #2)
> (In reply to Thomas Wolf from comment #1)
> > Happens to me on OS X in both Neon and Neon.1.
> > 
> > Switch from Mac theme to Dark theme works (bar minor glitches), but then a
> > switch back to the Mac theme fails big time.
> 
> Same stack trace?

Essentially, yes:

!ENTRY org.eclipse.ui 4 0 2016-09-21 22:43:36.738
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:64)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:196)
	at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler.runCommand(CocoaUIHandler.java:647)
	at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler.access$5(CocoaUIHandler.java:634)
	at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler$3.widgetSelected(CocoaUIHandler.java:506)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4514)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.SWT.error(SWT.java:4419)
	at org.eclipse.swt.graphics.GC.setForeground(GC.java:3440)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.onPaint(FormHeading.java:850)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.access$10(FormHeading.java:824)
	at org.eclipse.ui.internal.forms.widgets.FormHeading$1.handleEvent(FormHeading.java:583)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
	at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1275)
	at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:172)
	at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:765)
	at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:166)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5703)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSView.displayIfNeeded(NSView.java:151)
	at org.eclipse.swt.widgets.Control.update(Control.java:5096)
	at org.eclipse.swt.widgets.Display.update(Display.java:4927)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211)
	at org.eclipse.ui.internal.handlers.ShowPreferencePageHandler.execute(ShowPreferencePageHandler.java:59)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:54)
	... 42 more

!ENTRY org.eclipse.ui 4 0 2016-09-21 22:43:36.863
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4514)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.SWT.error(SWT.java:4419)
	at org.eclipse.swt.graphics.GC.setForeground(GC.java:3440)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.onPaint(FormHeading.java:850)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.access$10(FormHeading.java:824)
	at org.eclipse.ui.internal.forms.widgets.FormHeading$1.handleEvent(FormHeading.java:583)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
	at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1275)
	at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:172)
	at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:765)
	at org.eclipse.swt.widgets.Canvas.drawRect(Canvas.java:166)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5703)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5076)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5457)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:94)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3692)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Comment 4 Lars Vogel CLA 2016-09-22 03:29:48 EDT
I cannot reproduce on Linux. 

Elena / Thomas: 

Our CSS handlers for Forms are CSSPropertyTitleFormsHandler (which should be the one relevant here and CSSPropertyFormHandler). Maybe you can debug this issue and provide a patch?
Comment 5 Thomas Wolf CLA 2016-09-22 13:30:02 EDT
(In reply to Lars Vogel from comment #4)
> I cannot reproduce on Linux. 
> 
> Elena / Thomas: 
> 
> Our CSS handlers for Forms are CSSPropertyTitleFormsHandler (which should be
> the one relevant here and CSSPropertyFormHandler). Maybe you can debug this
> issue and provide a patch?

I can also reproduce this on Ubuntu 15.10/GTK 3. Again, essentially the same stack trace as Elena's; see below.

I can't debug this; I don't know that theme stuff at all and I don't have the time to catch up on it.

Steps to reproduce:

1. Start Eclipse (in native theme, Mac or GTK)
2. Open Preferences->General->Appearance
3. Select dark theme, click apply
4. Select Mac or GTK theme, click apply

!ENTRY org.eclipse.ui 4 0 2016-09-22 19:10:55.168
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4514)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.SWT.error(SWT.java:4419)
	at org.eclipse.swt.graphics.GC.setForeground(GC.java:3649)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.onPaint(FormHeading.java:850)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.access$10(FormHeading.java:824)
	at org.eclipse.ui.internal.forms.widgets.FormHeading$1.handleEvent(FormHeading.java:583)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1349)
	at org.eclipse.swt.widgets.Control.gtk_draw(Control.java:3361)
	at org.eclipse.swt.widgets.Composite.gtk_draw(Composite.java:367)
	at org.eclipse.swt.widgets.Canvas.gtk_draw(Canvas.java:172)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1962)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5819)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5490)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9545)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1275)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2495)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4141)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.open(WorkbenchPreferenceDialog.java:211)
	at org.eclipse.ui.internal.OpenPreferencesAction.run(OpenPreferencesAction.java:63)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5219)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4553)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4143)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Comment 6 Thomas Wolf CLA 2016-09-22 15:52:26 EDT
(In reply to Thomas Wolf from comment #5)
> Steps to reproduce:
> 
> 1. Start Eclipse (in native theme, Mac or GTK)
> 2. Open Preferences->General->Appearance
> 3. Select dark theme, click apply
> 4. Select Mac or GTK theme, click apply

I forgot:

1.5. : Open the Git staging view (which uses Forms)

Also occurs on Ubuntu 16.04. On GTK, I have so far not observed UI blocks after this exception, while on Mac they are very frequent.

I notice that when switching to dark theme, the form heading backgrounds in the staging view do not update.
Comment 7 Andrey Loskutov CLA 2017-02-22 05:34:16 EST
Still reproducible on 4.7 head.

java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:4514)
	at org.eclipse.swt.SWT.error(SWT.java:4448)
	at org.eclipse.swt.SWT.error(SWT.java:4419)
	at org.eclipse.swt.graphics.GC.setForeground(GC.java:3547)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.onPaint(FormHeading.java:826)
	at org.eclipse.ui.internal.forms.widgets.FormHeading.lambda$0(FormHeading.java:576)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5223)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1357)
	at org.eclipse.swt.widgets.Control.gtk_draw(Control.java:3392)
	at org.eclipse.swt.widgets.Composite.gtk_draw(Composite.java:344)
	at org.eclipse.swt.widgets.Canvas.gtk_draw(Canvas.java:175)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1938)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:6033)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5483)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9203)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1250)
	at org.eclipse.swt.internal.gtk.OS._gdk_window_process_updates(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_window_process_updates(OS.java:5609)
	at org.eclipse.swt.widgets.Control.update(Control.java:5973)
	at org.eclipse.swt.widgets.Control.update(Control.java:5959)
	at org.eclipse.jface.fieldassist.ControlDecoration.update(ControlDecoration.java:1039)
	at org.eclipse.jface.fieldassist.ControlDecoration$1.focusLost(ControlDecoration.java:613)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:144)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5223)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1353)
	at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:4094)
	at org.eclipse.swt.widgets.Control.gtk_event_after(Control.java:3364)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1962)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:6033)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5483)
	at org.eclipse.swt.internal.gtk.OS._gtk_widget_grab_focus(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_widget_grab_focus(OS.java:13867)
	at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2659)
	at org.eclipse.swt.widgets.Composite.forceFocus(Composite.java:572)
	at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2652)
	at org.eclipse.swt.widgets.Control.setFocus(Control.java:4701)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1520)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1518)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1518)
	at org.eclipse.ui.internal.views.log.LogView.setFocus(LogView.java:1140)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.delegateSetFocus(CompatibilityPart.java:216)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:255)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:261)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:232)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:107)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.focusGui(PartRenderingEngine.java:791)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.setFocus(ContributedPartRenderer.java:103)
	at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1518)
	at org.eclipse.swt.custom.CTabItem.setFocus(CTabItem.java:332)
	at org.eclipse.swt.custom.CTabFolder.setFocus(CTabFolder.java:2633)
	at org.eclipse.swt.widgets.Control.fixFocus(Control.java:239)
	at org.eclipse.swt.widgets.Control.setVisible(Control.java:5359)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3177)
	at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3134)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1301)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:68)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:233)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:144)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:5410)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:212)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:201)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:52)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:173)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:620)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:584)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:768)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:742)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:680)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:675)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:395)
	at org.eclipse.ui.internal.WorkbenchPage.bringToTop(WorkbenchPage.java:1059)
	at org.eclipse.ui.internal.views.log.LogView$25.run(LogView.java:1121)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4468)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4081)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1145)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1034)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Comment 8 Lars Vogel CLA 2017-02-22 05:39:19 EST
Related to the work in Bug 510228.
Comment 9 Andrey Loskutov CLA 2017-02-22 07:16:07 EST
(In reply to Lars Vogel from comment #8)
> Related to the work in Bug 510228.

Not sure. This is simply broken by design:

FormToolkit.decorateFormHeading(Form) *copies* color references from FormColors to the Form and so to the FormHeading, but at same time allows to dispose them on the call FormColors.setBackground(Color) -> FormColors.updateFormHeaderColors() -> disposeIfFound().

This way the FormHeading can still use colors already disposed by the FormColors.

I don't know why is this implemented this way, this is simply wrong. One should never dispose "public" colors used by clients.
Comment 10 Ralf Petter CLA 2017-02-22 07:59:40 EST
*** Bug 510777 has been marked as a duplicate of this bug. ***
Comment 11 Ralf Petter CLA 2017-02-22 08:16:03 EST
@Andrey I have already done some investigation work in bug 510777 for this problem. To me this bug here and 510777 look exactly the same. I have also developed a fix for this issue already, but unfortunately i am still in the hospital and i have no access to my work machine. If this is really a critical issue, i can recreate the patch on my laptop and upload it to gerrit. 

@Lars I think this problem is not related to the work in 510228.
Comment 12 Eclipse Genie CLA 2017-03-12 13:45:40 EDT
New Gerrit change created: https://git.eclipse.org/r/92861
Comment 13 Ralf Petter CLA 2017-03-17 04:51:45 EDT
I have uploaded a patch to gerrit which prevents the IllegalArgumentException on theme switching. There are still problems in the theme swithing code which makes problems to correctly reset the colors and gradients of forms on theme switch. But i think this bugs are only ui quirks and not critical anymore. So i hope someone can review and test my patch and can commit this change. I will open a new bug for the other problems and will work on theme.
Comment 14 Lars Vogel CLA 2017-04-03 16:11:47 EDT
(In reply to Eclipse Genie from comment #12)
> New Gerrit change created: https://git.eclipse.org/r/92861

Andrey, could you test this patch? On Linux I do not that the reported exception during theme switching, so I cannot validate the patch. Ralf told me via email that this patch should be ready for review.
Comment 15 Lars Vogel CLA 2017-04-05 02:48:12 EDT
(In reply to Lars Vogel from comment #14)
> (In reply to Eclipse Genie from comment #12)
> > New Gerrit change created: https://git.eclipse.org/r/92861
> 
> Andrey, could you test this patch? 

Andrey, are you available to test the patch?
Comment 16 Andrey Loskutov CLA 2017-04-05 02:54:03 EDT
(In reply to Lars Vogel from comment #15)
> Andrey, are you available to test the patch?

Yes, this is high on my list. May be even today.
Comment 17 Andrey Loskutov CLA 2017-04-05 03:38:35 EDT
While trying to reproduce promptly stumbled into bug 514744 :-)
Comment 18 Andrey Loskutov CLA 2017-04-05 05:14:52 EDT
(In reply to Andrey Loskutov from comment #17)
> While trying to reproduce promptly stumbled into bug 514744 :-)

I'm done with the review, looks good. I will push the change after fixing the issue above, so that one should not see any errors after switching themes.
Comment 19 Ralf Petter CLA 2017-04-05 06:14:35 EDT
I have tested my patch on opensuse Leap 42.2. Without the patch i can reproduce the IllegalArgumentException, with the patch applied the switch works without an exception.
Comment 21 Andrey Loskutov CLA 2017-04-05 07:40:30 EDT
Thanks Ralf.