Community
Participate
Working Groups
Build ID: 3.5M5 Steps To Reproduce: As per John A's comment bug 265028 comment 11, creating an Image on a non-UI thread (on Linux) attempts to lock the GTK SWT Platform Lock. The non-UI Thread may be holding other locks at the time which allows deadlock between the non-UI thread and the main thread. There's nothing on ImageDescriptor#createImage() that says Images must only be created on the UI thread. It looks like if Display.getDefault() == null it's initialised correctly in the Image constructor: Resource(Device device) { if (device == null) device = Device.getDevice(); ... } More information: "Worker-5" prio=1 tid=0x0954c9d8 nid=0x17eb in Object.wait() [0x66593000..0x66593e50] at java.lang.Object.wait(Native Method) - waiting on <0x727f88e8> (a org.eclipse.swt.internal.Lock) at java.lang.Object.wait(Unknown Source) at org.eclipse.swt.internal.Lock.lock(Lock.java:34) - locked <0x727f88e8> (a org.eclipse.swt.internal.Lock) at org.eclipse.swt.internal.gtk.OS.g_utf16_to_utf8(OS.java:2840) at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) at org.eclipse.swt.graphics.Image.initNative(Image.java:541) at org.eclipse.swt.graphics.Image.<init>(Image.java:531) at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:162) at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:227) at org.eclipse.ui.internal.registry.EditorDescriptor.getImageDescriptor(EditorDescriptor.java:294) - locked <0x727bf3d8> (a java.lang.Object) at org.eclipse.ui.internal.registry.EditorRegistry.getImageDescriptor(EditorRegistry.java:1423) at org.eclipse.ui.internal.ide.ContentTypeDecorator.decorate(ContentTypeDecorator.java:53)
bug 88255 (which was closed for lack of activity) shows the same problem Oleg encountered in Platform. Should the (in-)ability to create Image & other SWT Resources on non-UI threads be Java Doc'd or possibly warn / throw an Invalid Thread Access exception. It's not clear that to users of the API that this will work on Windows but won't work on GKT Linux
(In reply to comment #1) > Should the (in-)ability to create Image & other SWT Resources on non-UI threads > be Java Doc'd or possibly warn / throw an Invalid Thread Access exception? > > It's not clear that to users of the API that this will work on Windows but > won't work on GKT Linux Or, given that this works unless clients have their own locks, perhaps the better solution would be for SWT GTK to release it's lock before calling client code. It can always re-acquire the lock if the client calls back into it. ... at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1453) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1156) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1180) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1165) at org.eclipse.swt.widgets.Tree.gtk_test_expand_row(Tree.java:2030) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1570) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4178) 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:7534) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1184) ...
Silenio, don't we have a bug for this problem already ?
Is this still reproducible?
Closing this ticket now as there has been no response in awhile. Please reopen it if you can reproduce the issue on GTK3.22/24 using SWT 4.10.