Bug 496379

Summary: NPE when disposing Zest graph with connection inside a container
Product: [Tools] GEF Reporter: Daniel Gomez Esperon <danielgomezesperon>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: danielgomezesperon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Daniel Gomez Esperon CLA 2016-06-20 06:01:20 EDT
I am using Zest containers to visualize state graphs.
In my special case when the graph is disposed and all the widgets get disposed too, a NPE is thrown for each connection that is disposed.

A simple setup to reproduce is a (Zest)Graph, a GraphContainer widget in that graph, and inside that graph container two GraphNodes. A GraphConnection connects the nodes inside the same container.

The NPE:
When the disposing process reaches the GraphConnection, at some point org.eclipse.zest.core.widgets.GraphConnection.removeFigure() is called.
The connection as well as the source node and target node a members of the same container. therefore the fields connectionFigure, sourceContainerConnectionFigure and targetContainerConnectionFigure point to the same object.

The connectionFigure is removed from its parent, which leads to the NPE when trying to remove source- and targetContainerConnectionFigure from its now null parent.

Thanks for taking a look at it.