Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 63922

Summary: Using M9, I got "Widget is disposed" error when overriding and update with HEAD contents
Product: [Eclipse Project] Platform Reporter: Olivier Thomann <Olivier_Thomann>
Component: CVSAssignee: Michael Valenta <Michael.Valenta>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2004-05-25 13:25:41 EDT
Using M9, I replace one file with its HEAD contents using "Override and update"
action and I got this:

org.eclipse.swt.SWTException: Widget is disposed
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at org.eclipse.swt.SWTException.<init>(SWTException.java:73)
at org.eclipse.swt.SWT.error(SWT.java:2689)
at org.eclipse.swt.SWT.error(SWT.java:2614)
at org.eclipse.swt.SWT.error(SWT.java:2585)
at org.eclipse.swt.widgets.Widget.error(Widget.java:381)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java)
at org.eclipse.swt.widgets.TreeItem.setImage(TreeItem.java)
at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java)
at
org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
at org.eclipse.core.runtime.Platform.run(Platform.java)
at
org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java)
at
org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java)
at org.eclipse.core.runtime.Platform.run(Platform.java)
at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java)
at org.eclipse.jface.viewers.StructuredViewer.update(StructuredViewer.java)
at org.eclipse.jface.viewers.StructuredViewer.update(StructuredViewer.java:1280)
at
org.eclipse.team.internal.ui.synchronize.SynchronizeModelProvider$LabelUpdateJob.runInUIThread(SynchronizeModelProvider.java:95)
at org.eclipse.ui.progress.UIJob$1.run(UIJob.java)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:253)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:97)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:307)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:256)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:59)
at java.lang.reflect.Method.invoke(Method.java:390)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:638)
at org.eclipse.core.launcher.Main.main(Main.java:622)
Comment 1 Jean-Michel Lemieux CLA 2004-05-27 10:27:32 EDT
This looks like the same problem we had seen and UI had fixed. They must check
for disposed tree items.
Comment 2 Michael Valenta CLA 2004-05-28 10:21:07 EDT
The UI fix was to continue processing other label changes so at least the view 
labels don't disappear. any exceptions that occur are still logged.
Comment 3 Michael Valenta CLA 2004-05-28 10:46:38 EDT
Before we post the label changes, we check to make sure that the viewer's 
control is not disposed. However, we do not ensure that the model objects 
being past are still in the viewer. The viewer contain an internal hashmap 
that maps objects to tree items and the viewer updates the cache when items 
are added and removed. When an update is requested, if there is no 
corresponding item for a model object, the object is ignored. Howewer, it 
appears that the cache in the tree viewer has held on to a disposed item which 
is resulting in the exception included in this report.

There are two possible causes. The equality check of the model elements could 
be off or the internal cache of the Tree could have a bug. I will verify that 
the model object's equality checks are right before moving to UI.
Comment 4 Michael Valenta CLA 2004-05-28 11:03:23 EDT
I have verified that our equality checks look right. However, the hashCode 
does not so it may be related to that. I will fix the hashCode determination.
Comment 5 Michael Valenta CLA 2004-05-28 11:35:22 EDT
I have entered bug 64572 against compare because the hashCode value of an 
object can change. I have also ensured that the sync model elements have the 
proper equals and hashCode. The proper equals was missing from the 
UnchangedContainer and the hashCode was wrong entirely.