Bug 433746 - [QuickAccess] SWTException on closing quick access shell
Summary: [QuickAccess] SWTException on closing quick access shell
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.4   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.5 M7   Edit
Assignee: Elena Laskavaia CLA
QA Contact:
URL:
Whiteboard:
Keywords: greatfix
Depends on:
Blocks: 462467
  Show dependency tree
 
Reported: 2014-04-29 06:05 EDT by Stefan Bodenstein CLA
Modified: 2015-04-30 08:17 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 Stefan Bodenstein CLA 2014-04-29 06:05:55 EDT
If you try to close the quick access shell you get an exception.
This happen if you run Window Tester tests, which try to close all open shells on tear down.

Best Regards Stefan

Caused by: org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.SWT.error(SWT.java:4327)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:413)
	at org.eclipse.swt.widgets.Text.setText(Text.java:2458)
	at org.eclipse.ui.internal.quickaccess.SearchField$2.doClose(SearchField.java:156)
	at org.eclipse.ui.internal.quickaccess.SearchField$3.shellClosed(SearchField.java:201)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4425)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1412)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1397)
	at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:646)
	at org.eclipse.swt.widgets.Shell.close(Shell.java:642)
	at com.windowtester.runtime.swt.internal.junit.SWTCleanupHandler$1.closeShells(SWTCleanupHandler.java:186)
	at com.windowtester.runtime.swt.internal.junit.SWTCleanupHandler$1.run(SWTCleanupHandler.java:162)
Comment 1 Paul Webster CLA 2014-04-29 06:26:32 EDT
It looks like it closed the WorkbenchWindow shell and then the quick access shell (which doesn't happen in real life).  Please describe how to cause the problem with the vanilla eclipse.

PW
Comment 2 Elena Laskavaia CLA 2014-10-09 16:01:11 EDT
I have a fix for 
https://git.eclipse.org/r/#/c/34419/

I understand if you asking for example if you need to investigate to
fix it, but if fix is known and safe to apply, can we just apply the patch?

I have same issue with SWTBot tests on RCP app, and fix took 2 minutes, but
it may take hours to reproduce it on something else.
Comment 3 Dani Megert CLA 2014-10-13 07:26:46 EDT
(In reply to Elena Laskavaia from comment #2)
> I have a fix for 
> https://git.eclipse.org/r/#/c/34419/
> 
> I understand if you asking for example if you need to investigate to
> fix it, but if fix is known and safe to apply, can we just apply the patch?
> 
> I have same issue with SWTBot tests on RCP app, and fix took 2 minutes, but
> it may take hours to reproduce it on something else.

The SearchField can assume that is is used in a correct way where the error isn't happening. The guards shouldn't be necessary. We need check which client code is wrong and fix it there.
Comment 4 Elena Laskavaia CLA 2014-10-20 10:08:15 EDT
Client code is testing framework that is doing programmatic shutdown
Its SWTBot in my case, but originator reported it from Window tester
which is another testing framework. I cannot provide a small example since
it is RCP application being tested. I can provide full backtrace, but
it probably won't be enough because it will in dispatch loop rather
from shutdown call itself.
Comment 5 Dani Megert CLA 2014-10-20 10:26:06 EDT
(In reply to Elena Laskavaia from comment #4)
> Client code is testing framework that is doing programmatic shutdown
> Its SWTBot in my case, but originator reported it from Window tester
> which is another testing framework. I cannot provide a small example since
> it is RCP application being tested. I can provide full backtrace, but
> it probably won't be enough because it will in dispatch loop rather
> from shutdown call itself.

This would probably look similar to the one in comment 0 I guess.


You could remote debug the running tests and add a breakpoint when the quick access gets closed/disposed. That way you might find out why it is closed two times.
Comment 6 Elena Laskavaia CLA 2015-02-20 21:54:48 EST
This is my backtrace

ENTRY org.eclipse.ui 4 0 2015-02-20 21:53:45.347
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed)
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:139)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3806)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3444)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at com.reflexit.magiccards_rcp.MAApplication.start(MAApplication.java:103)
	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:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
	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:483)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4441)
	at org.eclipse.swt.SWT.error(SWT.java:4356)
	at org.eclipse.swt.SWT.error(SWT.java:4327)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:476)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:413)
	at org.eclipse.swt.widgets.Text.setText(Text.java:2463)
	at org.eclipse.ui.internal.quickaccess.SearchField$2.doClose(SearchField.java:160)
	at org.eclipse.ui.internal.quickaccess.SearchField$3.shellClosed(SearchField.java:207)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4486)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1412)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1397)
	at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:647)
	at org.eclipse.swt.widgets.Shell.close(Shell.java:643)
	at org.eclipse.swtbot.swt.finder.widgets.SWTBotShell$2.run(SWTBotShell.java:101)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$5.doRun(UIThreadRunnable.java:221)
	at org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable$1.run(UIThreadRunnable.java:89)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	... 25 more
Comment 7 Elena Laskavaia CLA 2015-02-20 22:03:08 EST
Add related Bug 259895
Comment 8 Elena Laskavaia CLA 2015-02-20 22:31:16 EST
I think what happened here is bot closes all active shells during reset workbech operation, besides the main eclipse shell.
SearchField keeps some sort of invisible shell around which I assume it does not expect to be closed. So when it gets closed it creates havok in the class and bunch of disposed widgets which are not re-created.
So patch I created really does not solve the problem...
Comment 9 Elena Laskavaia CLA 2015-02-22 13:21:44 EST
Submitted another patch in attempt to dispose the shell properly

https://git.eclipse.org/r/#/c/34419/ Bug 433746: dispose SearchField shell properly
Comment 10 Sergey Prigogin CLA 2015-04-01 04:09:20 EDT
Dani, are you OK with the latest patch? It looks fine to me.
Comment 11 Dani Megert CLA 2015-04-01 05:05:33 EDT
(In reply to Sergey Prigogin from comment #10)
> Dani, are you OK with the latest patch? It looks fine to me.

See my comment in Gerrit.
Comment 13 Lars Vogel CLA 2015-04-17 04:30:31 EDT
Thanks Elena.
Comment 14 Lars Vogel CLA 2015-04-28 06:30:14 EDT
Elena, can you validate this fix in one of the latest integration builds?
Comment 15 Elena Laskavaia CLA 2015-04-28 08:30:41 EDT
(In reply to Lars Vogel from comment #14)
> Elena, can you validate this fix in one of the latest integration builds?

Where integration builds are posted?
Comment 16 Lars Vogel CLA 2015-04-28 08:35:22 EDT
(In reply to Elena Laskavaia from comment #15)
> (In reply to Lars Vogel from comment #14)
> > Elena, can you validate this fix in one of the latest integration builds?
> 
> Where integration builds are posted?

The one from today is here:  http://download.eclipse.org/eclipse/downloads/drops4/I20150428-0100/

Or in general you find the latest and greatest on the following website: http://download.eclipse.org/eclipse/downloads/
Comment 17 Brian de Alwis CLA 2015-04-29 12:20:17 EDT
This fix looks like the reason for bug 462467 and needs to be reverted IMHO.  The call to quickAccessContents.doClose() would reset the different providers which is no longer being performed.

The code in SearchField and the QuickAccessContents subclass is already higgledy-piggledy.  Why can't the doClose() perform isDisposed() tests on the text field and the shell?
Comment 18 Eclipse Genie CLA 2015-04-29 12:46:00 EDT
New Gerrit change created: https://git.eclipse.org/r/46796
Comment 19 Brian de Alwis CLA 2015-04-29 12:52:17 EDT
I've pushed up an alternative patch: the SearchClosingTest still passes.

Note that there are the failures in the QuickAccessTestSuite, specifically QuickAccessDialogTests, that are not caused by this change.  The QATS is not currently being run as part of the UiTestSuite.  I've opened bug 465842 to track.
Comment 20 Dani Megert CLA 2015-04-30 08:17:48 EDT
Please see bug 462467 comment 9 and let's continue the discussion there.