Bug 245295 - [CommonNavigator] org.eclipse.swt.SWTException: Widget is disposed error on starting Eclipse
Summary: [CommonNavigator] org.eclipse.swt.SWTException: Widget is disposed error on ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Francis Upton IV CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2008-08-26 14:33 EDT by Alexej Spas CLA
Modified: 2008-09-04 11:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexej Spas CLA 2008-08-26 14:33:00 EDT
Build ID: I20080617-2000

Steps To Reproduce:
THis looks like a problem in org.eclipse.jface plugin. I'm getting it on 3.4 when working with standard navigator view.

When Eclipse is starting, it shows errors like org.eclipse.swt.SWTException: Widget is disposed  error 
and as a result navigator view becomes empty.

I was doing small investigation of this case. Here are the results:

Seems like problem is appearing only when workspace is reconstructing navigator TreeViewer state from IMemento. Old TreeItems in navigator tree viewer are disposed via calls like:

Thread [main] (Suspended (breakpoint at line 810 in Widget))	
	TreeItem(Widget).release(boolean) line: 810	
	Tree.removeAll() line: 3923	
	CommonViewer(TreeViewer).removeAll(Control) line: 319	
	AbstractTreeViewer$5.run() line: 1472	
	CommonViewer(StructuredViewer).preservingSelection(Runnable, boolean) line: 1365	
	CommonViewer(TreeViewer).preservingSelection(Runnable, boolean) line: 397	
	CommonViewer(StructuredViewer).preservingSelection(Runnable) line: 1328	
	CommonViewer(AbstractTreeViewer).inputChanged(Object, Object) line: 1467	
	CommonViewer(ContentViewer).setInput(Object) line: 251	
	CommonViewer(StructuredViewer).setInput(Object) line: 1603	
	WorkingSetActionProvider.restoreState(IMemento) line: 239	
	NavigatorActionService.initialize(String, CommonActionProvider) line: 350	
	NavigatorActionService.getActionProviderInstance(CommonActionProviderDescriptor) line: 333	
	NavigatorActionService.fillActionBars(IActionBars) line: 236	
	CommonNavigatorManager.selectionChanged(SelectionChangedEvent) line: 220	
	Viewer$2.run() line: 162	
	SafeRunner.run(ISafeRunnable) line: 37	
	Platform.run(ISafeRunnable) line: 880	
	JFaceUtil$1.run(ISafeRunnable) line: 48	
	SafeRunnable.run(ISafeRunnable) line: 175	
	CommonViewer(Viewer).fireSelectionChanged(SelectionChangedEvent) line: 160	
	CommonViewer(StructuredViewer).updateSelection(ISelection) line: 2062	
	CommonViewer(StructuredViewer).setSelection(ISelection, boolean) line: 1638	
	CommonViewer(TreeViewer).setSelection(ISelection, boolean) line: 1104	
	CommonViewer.setSelection(ISelection, boolean) line: 327	
	CommonNavigator.selectReveal(ISelection) line: 314	
	LinkEditorAction$3.run() line: 99	
	SafeRunner.run(ISafeRunnable) line: 37	
	LinkEditorAction$2.runInUIThread(IProgressMonitor) line: 87	
	UIJob$1.run() line: 94	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 133	
	Display.runAsyncMessages(boolean) line: 3800	
	Display.readAndDispatch() line: 3425	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2382	
	Workbench.runUI() line: 2346	
	Workbench.access$4(Workbench) line: 2198	
	Workbench$5.run() line: 493	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	Application.start(IApplicationContext) line: 90	
	EclipseAppHandle.run(Object) line: 193	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 382	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	Method.invoke(Object, Object...) line: not available	
	Main.invokeFramework(String[], URL[]) line: 549	
	Main.basicRun(String[]) line: 504	
	Main.run(String[]) line: 1236	
	Main.main(String[]) line: 1212	

And I suspect that problem is in function CommonViewer(TreeViewer).removeAll(Control) line: 319 that looks like:
	protected void removeAll(Control widget) {
		((Tree) widget).removeAll();
	}
But it does not unregister deleted TreeItems from cache element map on StructuredViewer level.  Other remove methods are doing so by calling disassociate((Item) childItem);

As a result of these actions, next call to protected final Widget[] findItems(Object element) in StructuredViewer returns disposed TreeItems and any manipulation with them produces exception org.eclipse.swt.SWTException: Widget is disposed

Hope this helps..


More information:
Comment 1 Francis Upton IV CLA 2008-08-27 02:05:06 EDT
Alexj, can you try this against some maintenance build after M20080827-0800, or 3.4.1 when that comes out?  There have been some fixes in this area that might have resolved this issue.
Comment 2 Alexej Spas CLA 2008-09-04 11:01:08 EDT
you are right. I can't reproduce it on latest build in 3.4.1 branch. Thanks