Bug 98929 - Widget disposed exception occured in the PackageExplorerPart
Summary: Widget disposed exception occured in the PackageExplorerPart
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2005-06-08 09:34 EDT by Gunnar Wagenknecht CLA
Modified: 2009-08-30 02:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2005-06-08 09:34:11 EDT
3.1 RC1

I don't have any steps to reproduce the problem. I just found this exception in
the log file. I was checking out some resources from CVS at this time. But I'm
pretty sure that the Package Explore wasn't open in the CVS perspective.

!ENTRY org.eclipse.ui 4 4 2005-06-08 15:10:14.334
!MESSAGE Unhandled event loop exception

!ENTRY org.eclipse.ui 4 0 2005-06-08 15:10:14.334
!MESSAGE Widget is disposed
!STACK 0
org.eclipse.swt.SWTException: Widget is disposed
    at org.eclipse.swt.SWT.error(SWT.java:2940)
    at org.eclipse.swt.SWT.error(SWT.java:2863)
    at org.eclipse.swt.SWT.error(SWT.java:2834)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:395)
    at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:297)
    at org.eclipse.swt.widgets.Widget.getData(Widget.java:448)
    at
org.eclipse.jface.viewers.AbstractTreeViewer.updateChildren(AbstractTreeViewer.java:1764)
    at
org.eclipse.jface.viewers.AbstractTreeViewer.internalRefreshStruct(AbstractTreeViewer.java:1268)
    at
org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1245)
    at
org.eclipse.jface.viewers.AbstractTreeViewer.internalRefresh(AbstractTreeViewer.java:1201)
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProblemTreeViewer.internalRefresh(PackageExplorerPart.java:492)
    at org.eclipse.jface.viewers.StructuredViewer$8.run(StructuredViewer.java:1291)
    at
org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1201)
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$PackageExplorerProblemTreeViewer.preservingSelection(PackageExplorerPart.java:598)
    at
org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1289)
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$3.run(PackageExplorerContentProvider.java:615)
    at
org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider$7.run(PackageExplorerContentProvider.java:659)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:118)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:2906)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2565)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
    at org.eclipse.jface.window.Window.open(Window.java:787)
    at
org.eclipse.team.internal.ccvs.ui.actions.CheckoutAsAction.execute(CheckoutAsAction.java:31)
    at org.eclipse.team.internal.ccvs.ui.actions.CVSAction.run(CVSAction.java:117)
    at org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDelegate.java:70)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:236)
    at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
    at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at
org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2929)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
    at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
    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.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.Main.main(Main.java:948)

!ENTRY org.eclipse.core.resources 2 1 2005-06-08 15:10:14.365
!MESSAGE Skipping builder org.antlr.eclipse.core.antlrbuilder for project
net.sourceforge.clearcase. Either the builder is missing from the install, or it
belongs to a project nature that is missing or disabled.
Comment 1 Dirk Baeumer CLA 2005-06-08 16:20:18 EDT
Gunnar, any steps to reproduce. And an additional question: was the package
explorer open when the exception occurred or was it closed ?
Comment 2 Gunnar Wagenknecht CLA 2005-06-09 01:29:22 EDT
No, sorry. I just found this in the log, while I was investigating another issue
in the CVS component. I was in the CVS perspective and the Package Explorer
wasn't open there. But it was opend in the Java perspective. There was no popup
dialog, thus I didn't realize this error in the UI.
Comment 3 Dirk Baeumer CLA 2005-06-09 03:18:37 EDT
Given that this happened while the package explorer was open points more to a
JFace viewer problem (accessing an already disposed item) then to a problem in
the package explorer.

However without any hint how and when this happens hard to fix. Setting to
Remind and CCing Nick to get a opinion from JFace.
Comment 4 Nick Edgar CLA 2005-06-09 10:02:12 EDT
It's always possible for a widget to be disposed between the time an asyncExec
gets queued and the time it's run.
PackageExplorerContentProvider.postRunnable's trackedRunnable should check that
the widget hasn't been disposed before running r.
Recommend checking other occurrences of asyncExec in JDT.
Comment 5 Dirk Baeumer CLA 2005-06-09 10:54:05 EDT
Nick, as gunnar pointed out the package explorer was still open when the
exception happened. So the exception can't come from a already disposed package
explorer.

Furthermore, the check you mention is already in. The tracked runnable posted in
postRunnable typically look like this (for example for the refresh it is)

new Runnable() {
	public void run() {
		Control ctrl= fViewer.getControl();
		if (ctrl != null && !ctrl.isDisposed()) {
			for (Iterator iter= toRefresh.iterator(); iter.hasNext();) {
				fViewer.refresh(iter.next(), updateLabels);
			}
		}
	}
}
Comment 6 Nick Edgar CLA 2005-06-09 11:25:24 EDT
Sorry, I missed that check.  So it does look like one of the items is disposed,
not the tree itself.

The strange thing is that it already successfully iterated over the same items
(also using getData()) just prior to that loop in
AbstractTreeViewer.updateChildren (see line 1764 of rev 1.65 of AbstractTreeViewer).

There are calls to equals, mapElement and disassociate (plus some calls directly
on the item), but none of these should dispose the item.  Is this still true in
the various overrides for the PE?
Comment 7 Dirk Baeumer CLA 2005-06-09 12:34:35 EDT
I looked over the code and we don't dispose any items in the overridden methods.

Gunnar, can you comment on whether your top level elements in the package
explorer are working sets or projects ?
Comment 8 Gunnar Wagenknecht CLA 2005-06-09 13:52:56 EDT
The top-level elements were projects. But a working set was active at this time.
Comment 9 Denis Roy CLA 2009-08-30 02:06:48 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.