Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Crash with beziers (Read 5265 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Crash with beziers
Jun 23rd, 2009 at 12:33pm
Print Post  
Hi,

I get the following crash when drawing a selection rectangle around nodes and links:
IndexOutOfRangeExectpion
Code
Select All
"   à MindFusion.Utilities.ApproxBezier(PointF[] points, Int32 startIdx, Int32 quality)
   à MindFusion.Diagramming.DiagramLink.x506928df783c0c72(Int32 x949108ddd7122fd3)
   à MindFusion.Diagramming.DiagramLink.xa170bf38e993d468(RectangleF x26545669838eb36e)
   à MindFusion.Diagramming.Diagram.x98d300fb770bf5ec(RectangleF x26545669838eb36e, Boolean x201ab38fe5644146)
   à MindFusion.Diagramming.Selection.AllowCreate(PointF current, InteractionState ist)
   à MindFusion.Diagramming.InteractionState.ValidateAndSetCursor(PointF point, Diagram diagram)
   à MindFusion.Diagramming.WinForms.DiagramView.OnMouseMove(MouseEventArgs e)
 



I using version 5.2.0 I think (Runtime version of my dlls: v2.0.50727) (.Net 2.0 version of the dlls but using .Net 3.5).

Thanks,
Marie
« Last Edit: Jun 23rd, 2009 at 2:28pm by marie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Crash with beziers
Reply #1 - Jun 23rd, 2009 at 1:11pm
Print Post  
Hi,

Bezier links should have SegmentCount * 3 + 1 control points. You will get that exception if you add or remove some points and that constraint is violated.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Crash with beziers
Reply #2 - Jun 23rd, 2009 at 1:23pm
Print Post  
Hi,

I don't play with Diagram.LinkSegments nor with link.SegmentCount and I always have beziers with 4 control points. My links are all drawn perfectly well. I can move nodes around (I added an event to redraw them when SelectionMoving & NodeModified). The problem occured for some reason when I select more than 1 node. Since I can't catch the exception, I still think it shouldn't throw it or that it should also be thrown when I set my control points.

Nevertheless, by changing Diagram.LinkSegments back to 1 (actually I just removed the initialization I had), the crash is gone Grin. I now respect the SegmentCount * 3 + 1 rule.

Thanks,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Crash with beziers
Reply #3 - Jun 23rd, 2009 at 1:30pm
Print Post  
Hi,

If SegmentCount is more than 1 while there are 4 control points you will get the exception. After setting ControlPoints, call the UpdateFromPoints(updateSegmentCoint) overloaded method to keep the segmentCount field in sync with the control points collection size.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Crash with beziers
Reply #4 - Jun 23rd, 2009 at 1:39pm
Print Post  
Hi,

Quote:
If SegmentCount is more than 1 while there are 4 control points you will get the exception.
I'm not playing with segments counts at all anymore. Therefore, since by default it is initialized to 1, it should always be 1 (I don't change it), unless your code changes it by itself. However, I just encountered the crash again Sad, but in different circumstances (moving a container weirdly moved some of its contained nodes outside of it (but they still belonged to the container). After that, I tried to select those nodes and BOOM.

I don't have your method UpdateFromPoints(updateSegmentCount) since I'm using an earlier version (waiting for the new 5.3 version).

Thanks,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Crash with beziers
Reply #5 - Jun 23rd, 2009 at 3:03pm
Print Post  
Could you copy your LinkCreating code here?
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Crash with beziers
Reply #6 - Jun 23rd, 2009 at 3:33pm
Print Post  
Hi Stoyan,

I just sent it to you by email.

Thanks!
Marie
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint