Community
Participate
Working Groups
Build ID: 2.0 Steps To Reproduce: I am seeing below exception when calling SWTBotShell.close(); 2009/01/03 14:29:08.359 SEVERE Unhandled event loop exception ::class.method=unknown ::thread=main ::loggername=org.eclipse.ui org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source) at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source) at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source) at org.eclipse.ui.internal.Workbench.runUI(Unknown Source) at org.eclipse.ui.internal.Workbench.access$4(Unknown Source) at org.eclipse.ui.internal.Workbench$5.run(Unknown Source) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Unknown Source) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown Source) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source) at com.ibm.rcp.personality.framework.internal.RCPApplication.run(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(Unknown Source) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Unknown Source) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Unknown Source) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Unknown Source) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:387) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) at org.eclipse.equinox.launcher.Main.main(Main.java:1212) Caused by: org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.widgets.Widget.error(Unknown Source) at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source) at org.eclipse.swt.widgets.Shell.close(Unknown Source) at net.sf.swtbot.widgets.SWTBotShell$2.run(SWTBotShell.java:85) at net.sf.swtbot.finder.UIThreadRunnable$5.doRun(UIThreadRunnable.java:238) at net.sf.swtbot.finder.UIThreadRunnable$1.run(UIThreadRunnable.java:88) at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source) ... 29 more More information: The problem seems to be that there is a notify sent and then asyn execution of close which is causing the exception. There should be a check to see that widget is not disposed before calling close. notify(SWT.Close); asyncExec(new VoidResult() { public void run() { widget.close(); } });
Fixed in trunk by adding a guard condition. Although I'm not very sure as to why the notification itself is disposing the shell. Is there a SWT.Close listener that is disposing the shell ? Please verify and mark as closed.
Created attachment 121478 [details] mylyn/context/zip
I debugged this little more and noticed that it happens with ContentAssist shell. It adds hooks for lots of events and I noticed that notify event is closing the shell.
Just found the class which is closing the shell on SWT.Close...it is in the org.eclipse.jface.text.contentassist.PopupCloser, which has shellClosed method registered to SWT.Close event.
I think that should be fine. A guard condition would not hurt, although the PopupCloser should probably not be closing the shell from within a shellClosed event. You should probably file a bug against JFace for this offense :)
I don't know if it is a bug in JFace because looking at Shell close method...all it does is sends SWT.Close event. public void close () { checkWidget (); closeWidget (); } void closeWidget () { Event event = new Event (); sendEvent (SWT.Close, event); if (event.doit && !isDisposed ()) dispose (); } (In reply to comment #5) > I think that should be fine. > > A guard condition would not hurt, although the PopupCloser should probably not > be closing the shell from within a shellClosed event. You should probably file > a bug against JFace for this offense :) >