Bug 314710

Summary: Selection not cleared when node disposed
Product: [Tools] GEF Reporter: Tim deBoer <deboer>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: irbull, Knut.Friedhelm
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Tim deBoer CLA 2010-05-27 11:54:42 EDT
When you dispose() a node within the graph, the node could currently remain in the selectedItems list. This causes the SWTException below the next time anyone clicks in the graph.

The selectedItems is private and can't be accessed externally, so the workaround is to call graph.setSelection(null) before disposing any node.


!ENTRY org.eclipse.ui 4 0 2010-05-27 11:52:53.734
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:467)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340)
	at org.eclipse.swt.widgets.Widget.getStyle(Widget.java:664)
	at org.eclipse.zest.core.widgets.GraphNode.getStyle(GraphNode.java:670)
	at org.eclipse.zest.core.widgets.GraphItem.checkStyle(GraphItem.java:112)
	at org.eclipse.zest.core.widgets.GraphNode.updateFigureForModel(GraphNode.java:758)
	at org.eclipse.zest.core.widgets.GraphNode.unhighlight(GraphNode.java:471)
	at org.eclipse.zest.core.widgets.Graph.clearSelection(Graph.java:724)
	at org.eclipse.zest.core.widgets.Graph.access$3(Graph.java:719)
	at org.eclipse.zest.core.widgets.Graph$DragSupport.mousePressed(Graph.java:690)
	at org.eclipse.draw2d.Figure.handleMousePressed(Figure.java:887)
	at org.eclipse.draw2d.SWTEventDispatcher.dispatchMousePressed(SWTEventDispatcher.java:214)
	at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseDown(LightweightSystem.java:513)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:185)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	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:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Ian Bull CLA 2010-05-27 13:22:41 EDT
Tim,

Are you using the Zest from Helios?  I know I fixed this recently, but maybe there is an edge case I missed.
Comment 2 Tim deBoer CLA 2010-05-27 13:29:13 EDT
It's Helios, but I've been using the same build since mid-last week when M7 was the latest posted: org.eclipse.zest.core_1.2.0.v20100426-2050.jar. If you've fixed since then, please go ahead and close or dup.
Comment 3 Ulli Hafner CLA 2010-08-16 04:57:16 EDT
This bug has been fixed only partly, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=218148.

I think there is still a problem, see comment #6 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=218148#c6).