Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » "Widget is disposed" when TreeColumnLayout is running
"Widget is disposed" when TreeColumnLayout is running [message #989251] Wed, 05 December 2012 10:58 Go to next message
Knut Wannheden is currently offline Knut WannhedenFriend
Messages: 298
Registered: July 2009
Senior Member
Hi all,

I just hit a problem which I think in fact is related to an SWT bug
(similar to what's reported here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288261). The problem I
face is that I have an SWTBot test which does some expanding and
colapsing in a tree and after the test is torn down I get the following
exception logged:

org.eclipse.swt.SWTException: Failed to execute runnable
(org.eclipse.swt.SWTException: Widget is disposed)
at org.eclipse.swt.SWT.error(SWT.java:4282)
at org.eclipse.swt.SWT.error(SWT.java:4197)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at
org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:4282)
at org.eclipse.swt.SWT.error(SWT.java:4197)
at org.eclipse.swt.SWT.error(SWT.java:4168)
at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
at org.eclipse.swt.widgets.Control.update(Control.java:4369)
at
org.eclipse.jface.layout.TreeColumnLayout$1.run(TreeColumnLayout.java:57)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
... 24 more

AFAICT the problem is that the TreeColumnLayout does an
Display#asyncExec() with a Runnable which doesn't check if the tree
widget has been disposed. But apparently it has already been disposed by
the test's teardown. Here is the relevant snippet from
TreeColumnLayout.java (lines 53-62):

private void update(final Tree tree) {
tree.getDisplay().asyncExec(new Runnable() {

public void run() {
tree.update();
tree.getParent().layout();
}

});
}

I will make sure to report this SWT bug. But in the meantime I would
like to know if anyone can think of a workaround in the test case?
(Please no sleep() hints.) I am thinking about scheduling a no-op using
Display#asyncExec(). Although I don't know if asyncExec() has a fair
scheduling policy or not.

Regards,

--knut
Re: "Widget is disposed" when TreeColumnLayout is running [message #991438 is a reply to message #989251] Wed, 19 December 2012 07:31 Go to previous message
Knut Wannheden is currently offline Knut WannhedenFriend
Messages: 298
Registered: July 2009
Senior Member
Hi,

In case anyone else comes across this problem I filed a ticket for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=395890.

--knut

On 12/5/12 11:58 AM, Knut Wannheden wrote:
> Hi all,
>
> I just hit a problem which I think in fact is related to an SWT bug
> (similar to what's reported here:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=288261). The problem I
> face is that I have an SWTBot test which does some expanding and
> colapsing in a tree and after the test is torn down I get the following
> exception logged:
>
> org.eclipse.swt.SWTException: Failed to execute runnable
> (org.eclipse.swt.SWTException: Widget is disposed)
> at org.eclipse.swt.SWT.error(SWT.java:4282)
> at org.eclipse.swt.SWT.error(SWT.java:4197)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
>
> at
> org.eclipse.swtbot.eclipse.core.UITestApplication.start(UITestApplication.java:54)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
> Caused by: org.eclipse.swt.SWTException: Widget is disposed
> at org.eclipse.swt.SWT.error(SWT.java:4282)
> at org.eclipse.swt.SWT.error(SWT.java:4197)
> at org.eclipse.swt.SWT.error(SWT.java:4168)
> at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
> at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
> at org.eclipse.swt.widgets.Control.update(Control.java:4369)
> at
> org.eclipse.jface.layout.TreeColumnLayout$1.run(TreeColumnLayout.java:57)
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
>
> ... 24 more
Previous Topic:Null control ids in SWTBot
Next Topic:SWTBot test wizard without workbench
Goto Forum:
  


Current Time: Thu Apr 25 01:00:00 GMT 2024

Powered by FUDForum. Page generated in 0.03176 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top