Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316288 - [Diagrams] Drag&Drop of links cause stack overflow
Summary: [Diagrams] Drag&Drop of links cause stack overflow
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Cedric Dumoulin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-09 09:24 EDT by Cedric Dumoulin CLA
Modified: 2010-06-10 07:02 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Dumoulin CLA 2010-06-09 09:24:00 EDT
Draging a link of any kind from the model explorer to a diagram cause a stack overflow.
This is due to the method org.eclipse.papyrus.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy.dropBinaryLink(CompositeCommand, Element, Element, int, Point, Element) which return its provided command, and then the command is added to itself ...
TODO: avoid returning the providing command to avoid such programming mistake.
Comment 1 Cedric Dumoulin CLA 2010-06-09 09:53:14 EDT
The returned type of dropBinaryLink() has been changed to void. This will prevent to add the CompoundCommand in itself inadvertently.
Comment 2 Vincent Hémery CLA 2010-06-10 05:56:43 EDT
Since this class is public and used by all diagrams, changing the signature of method CommonDiagramDragDropEditPolicy.dropBinaryLink is an API change and should change the plugin version.

The method was intended to return the compound command for convenience for coders (old calls with return take 1 line instead of 3).

In fact, there was only one incorrect call to this method that you yourself committed on 09/06/10 13:36 in commit 1859, in
org.eclipse.papyrus.diagram.common.editpolicies.CommonDiagramDragDropEditPolicy.getDropObjectsCommand(DropObjectsRequest)
on line 248
cc.add( dropBinaryLink(cc, source, target, linkVISUALID, dropRequest.getLocation(), (Element)droppedObject) );

Could you please either :
- 1. restore the old method signature and old correct calls,
 correct the incorrect call line 248 ,
 make the method's javadoc more explicit to avoid errors,

or

-2. update the plugin version,
 send a message to the devel list to inform users the signature has changed,
 correct the method's javadoc according to the new signature (@return),
 correct alll modified calls to restore the original labels of commands which have been replaced by "drop Association",
 correct non modified calls which still use the old signature or mention them in the message sent to the the devel list (I noticed at least activity and parameteric), so that people in charge of these diagram can adapt them.

Thank you.
Comment 3 Cedric Dumoulin CLA 2010-06-10 06:10:38 EDT
Ok, I restore the old code and open a bug to change the signature later.
Comment 4 Cedric Dumoulin CLA 2010-06-10 07:02:50 EDT
API has been reverted.
Stack overflow pb still corrected