Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Crash when cancelling link creation (Read 1256 times)
stefski
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 31
Location: Norway
Joined: Jul 17th, 2009
Crash when cancelling link creation
Jan 4th, 2011 at 1:32pm
Print Post  
Hi!

I am investigating a problem with our software, which crashes in the Cancel() method of the MindFusion.Diagramming.InteractionState class, when a link creation is cancelled by releasing the mouse button over the originating node (=not allowed in our application).

According to our call stack the Cancel() method is called twice:


[tt][color=Red]=>MindFusion.Diagramming.dll!MindFusion.Diagramming.InteractionState.Cancel(Mind
Fusion.Diagramming.Diagram diagram = {SPT.Olga.DiagramControl.OlgaDiagram}) Line 261
C#[/color]

MindFusion.Diagramming.dll!MindFusion.Diagramming.Diagram.DeleteItem(MindFusion.
Diagramming.DiagramItem item = {SPT.Olga.DiagramControl.VisualObjects.CaptionShapeNode}) Line 2091 + 0x13 bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.Group.DestroySelf(bool redo = false) Line 1552 + 0x10 bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.Commands.RemoveGroupCmd.Execut
e(bool undoEnabled = false) Line 44 + 0xf bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.UndoManager.ExecuteCommand(Min
dFusion.Diagramming.Commands.Command cmd = {MindFusion.Diagramming.Commands.RemoveGroupCmd}) Line 158 + 0xa bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.Commands.RemoveGroupCmd.Execut
e() Line 36 + 0x2a bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.Group.OnItemDeleted(MindFusion
.Diagramming.DiagramItem item = {SPT.Olga.DiagramControl.VisualObjects.AttachableDiagramLink}) Line 540 + 0x23 bytes
C#

MindFusion.Diagramming.dll!MindFusion.Diagramming.DiagramItem.OnRemove() Line 247 + 0x10 bytes
C#

SPT.Olga.DiagramControl.dll!SPT.Olga.DiagramControl.VisualObjects.AttachableDiag
ramLink.OnRemove() Line 56 + 0x8 bytes
C#

[color=Red]=>MindFusion.Diagramming.dll!MindFusion.Diagramming.InteractionState.Cancel(Mind
Fusion.Diagramming.Diagram diagram = {SPT.Olga.DiagramControl.OlgaDiagram}) Line 257 + 0xb bytes
C#[/color]

MindFusion.Diagramming.WinForms.dll!MindFusion.Diagramming.WinForms.Behaviors.Be
haviorBase.OnMouseUp(System.Drawing.Point mousePosition = {X = 617 Y = 204}, System.Windows.Forms.MouseButtons mouseButton = Left) Line 200 + 0x2a bytes
C#

MindFusion.Diagramming.WinForms.dll!MindFusion.Diagramming.WinForms.DiagramView.
OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 617 Y = 204 Button = Left}) Line 1192 + 0x4b bytes
C#[/tt]


The Cancel() method of the InteractionState class calls the OnRemove() method on the item, whose creation is being cancelled.
In this case, the item is an instance of our "AttachableDiagramLink" class (derived from DiagramLink).
The AttachableDiagramLink.OnRemove() calls base.OnRemove(), and this seems to be causing the trouble, because this in turn reaches the InteractionState.Cancel() method a second time.
As the second (reentrant) call to InteractionState.Cancel() completes, the currentItem property of the InteractionState is cleared, thus causing currentItem.FreeResources() in the first invocation to throw a NullReferenceException exception.

Are we not supposed to do base.OnRemove() in our DiagramLink-derived class? Or are we doing something else wrong?

Any advise is greatly appreciated!

(We are using FlowChart.NET version 5.5)
  

Kind regards

Steffen Skov
OLGA Application Architect
Schlumberger Information Solutions AS
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Crash when cancelling link creation
Reply #1 - Jan 4th, 2011 at 2:22pm
Print Post  
Hi,

Could you try setting Diagram.Interaction = null before calling the base method to see if that prevents reentrancy?

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint