Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 508106 - Dangling reference on DNode.outgoingEdges and incomingEdges after undo on Edge creation tool
Summary: Dangling reference on DNode.outgoingEdges and incomingEdges after undo on Edg...
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.0.7   Edit
Assignee: Florian Barbin CLA
QA Contact: Laurent Redor CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 508135 508138 508164
  Show dependency tree
 
Reported: 2016-11-24 06:19 EST by Florian Barbin CLA
Modified: 2017-01-31 08:49 EST (History)
1 user (show)

See Also:


Attachments
test case (1.35 KB, application/zip)
2016-11-24 06:19 EST, Florian Barbin CLA
no flags Details
test case (3.41 KB, application/zip)
2016-11-24 12:07 EST, Florian Barbin CLA
no flags Details
Use case for validation (comment 5) (3.04 KB, application/x-zip-compressed)
2016-11-24 12:14 EST, Laurent Redor CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Barbin CLA 2016-11-24 06:19:18 EST
Created attachment 265558 [details]
test case

Steps to reproduce:

* Import the attached test case and open the diagram "new Package"
* Create an edge between ClassA and ClassB with the edge creation tool.
* The edge is removed by the refresh => OK
* Perform undo
* With the Model requests interpreter view, select the ClassA Node and test this expression: aql:self.getOutgoingEdges
* A DEdge (detached from its parent) appears => KO
Comment 1 Florian Barbin CLA 2016-11-24 06:31:03 EST
In this test case, the edge creation tool create a new DEdge inconsistent with the mapping precondition. Therefore, the refresh will remove this edge in the same transaction.

The DEdge is created by org.eclipse.sirius.diagram.business.internal.experimental.sync.DDiagramElementSynchronizer.createNewEdge(...). The setSourceNode and setTargetNode methods are called before the attach to its parent so the changeRecorder does not record those feature changes but only the eOpposite (outgoingEdges).

When the DEdge cross references are removed, the sourceNode feature change is created. The changeRecorder consolidation does not know the first setSourceNode that why the undo partially reverse the changes.
Comment 2 Eclipse Genie CLA 2016-11-24 09:56:27 EST
New Gerrit change created: https://git.eclipse.org/r/85696
Comment 4 Florian Barbin CLA 2016-11-24 12:07:12 EST
Created attachment 265568 [details]
test case
Comment 5 Laurent Redor CLA 2016-11-24 12:14:06 EST
Created attachment 265569 [details]
Use case for validation (comment 5)

Steps used to validate (validated on a Sirius 2.0.7 stable 2.0.7-S20161124-100058):

* Import project from useCase_508106.zip
* Open the diagram "new Package"
* Open the "Model requests interpreter" view
* Write expression <%self.outgoingEdges%>
* Select the node "ClassA"
* Number of returned elements must be 0.
* Use the tool "Create Reference" between ClassA and ClassB (the edge is not visible, as expected)
* Undo
* Select again the node "ClassA"
* Number of returned elements must be 0. It is 1 with the bug.
Comment 6 Eclipse Genie CLA 2016-11-28 09:51:00 EST
New Gerrit change created: https://git.eclipse.org/r/85872
Comment 8 Pierre-Charles David CLA 2017-01-31 08:49:42 EST
Available in Sirius 2.0.7, see https://wiki.eclipse.org/Sirius/2.0.7.