Bug 488869

Summary: Zest Graphconection setCurveDepth NPE on dispose
Product: [Tools] GEF Reporter: Igor Klepi263 <igorklepic>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Simple test class for reproducing the exception none

Description Igor Klepi263 CLA 2016-03-02 10:28:25 EST
Created attachment 260052 [details]
Simple test class for reproducing the exception

Steps to reproduce:
1. Create a display and add a shell
2. Add a graph to a shell
3. Add a container
4. Add two nodes inside the container
5. Add a connection between the nodes
6. Set curve depth to the connection
7. When you try to dispose the display, NullPointerException is raised


More information:
This only happens if the nodes are connected with a curved connection inside the container. If the connection is straight or there is no container it works fine.

The problem in the removeFigure() method of GraphConnection.java

If you don't set the curveDepth then this.connectionFigure.parent is set to null, this.targetContainerConnectionFigure.parent and this.sourceContainerConnectionFigue.parent point on the same object(Container)

However if you set the curveDepth then for some reason the this.connectionFigure.parent also points to that same object(Container) and the exception is raised when called
 
sourceContainerConnectionFigure.getParent().remove(sourceContainerConnectionFigure);


Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.zest.core.widgets.GraphConnection.removeFigure(GraphConnection.java:159)
	at org.eclipse.zest.core.widgets.Graph.removeConnection(Graph.java:979)
	at org.eclipse.zest.core.widgets.GraphConnection.dispose(GraphConnection.java:176)
	at org.eclipse.zest.core.widgets.Graph.release(Graph.java:773)
	at org.eclipse.zest.core.widgets.Graph.access$6(Graph.java:763)
	at org.eclipse.zest.core.widgets.Graph$5.widgetDisposed(Graph.java:216)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1118)
	at org.eclipse.swt.widgets.Widget.release(Widget.java:822)
	at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:891)