Bug 488869 - Zest Graphconection setCurveDepth NPE on dispose
Summary: Zest Graphconection setCurveDepth NPE on dispose
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Zest (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-02 10:28 EST by Igor Klepi263 CLA
Modified: 2016-03-02 10:28 EST (History)
0 users

See Also:


Attachments
Simple test class for reproducing the exception (1.30 KB, application/octet-stream)
2016-03-02 10:28 EST, Igor Klepi263 CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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)