Community
Participate
Working Groups
Created attachment 276469 [details] Snippet to reproduce the problem with. Run and observe no exception. Running the attached snippet "Bug_test_disposed_color.java" on 4.9 platform results in: Exception in thread "main" java.lang.IllegalArgumentException: Argument not valid Running the snippet on 4.10 results in no exception. The change is coming from GTK2 support removal in 4.10, commit: https://git.eclipse.org/c/platform/eclipse.platform.swt.git/diff/bundles/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/widgets/Control.java?id=653f05d5c8bf3e06e39139572ab8e000d66bc4bc public void setForeground (Color color) { checkWidget(); if (((state & FOREGROUND) == 0) && color == null) return; - GdkColor gdkColor = null; - if (color != null) { - if (color.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); - gdkColor = color.handle; - } No exception means programming errors which dispose a color would go unnoticed and there would be no effect in setting the disposed color; Control.setForegroundGdkRGBA will use the default foreground color in case the color is disposed.
Simeon, can you provide a patch and test? Please for the test, check not only setForeground() but also setBackground(). Not sure what it was in 4.9, but on 4.10 it is also broken in the sense that instead of IllegalArgumentException as declared in javadoc it throws "org.eclipse.swt.SWTException: Graphic is disposed".
New Gerrit change created: https://git.eclipse.org/r/131939
Gerrit change https://git.eclipse.org/r/131939 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4d89403a72c43b535e3cee44a63a52ac58799144
(In reply to Eclipse Genie from comment #3) > Gerrit change https://git.eclipse.org/r/131939 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=4d89403a72c43b535e3cee44a63a52ac58799144 In master now.
Verified in I20181120-0600.