Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DropInDocVB problems (Read 2817 times)
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
DropInDocVB problems
Jun 3rd, 2011 at 10:45pm
Print Post  
I found that FlowChartX isn't properly destroyed when I destroy the form where it is instanteated, and my program ends in a crash, sooner or later.

After a full week trying to find out what could be wrong, I found that it only happens after initiating a Drag&Drop operation with FlowChartX. A simple DragOver, without dropping, is enough to cause troubles.

In my environment I have the need to use *VB events during DragDrop operations.

I'm able to query DataObject.GetFormat and proceed with GetData method, and everything seems to work fine. But the "Garbage Collector" is unable to clean up things after closing FC, so it seems that some reference to IVBDataObject is left behind. I even tryed to call RevokeDragDrop after each operation, but the result is the same.

Is there anything else I can try?

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DropInDocVB problems
Reply #1 - Jun 4th, 2011 at 8:59am
Print Post  
What kind of garbage collecting are you referring to? And what do your DragOver and DropOver handlers look like? The flowchart immediately releases the IVBDataObject reference count after raising the event, so if there's any reference left to the object, it's probably added by the event handlers.

Also make sure you don't keep references to any nodes or links after the form is closed. Their code often calls methods of the flowchart, and that might lead to a crash the flowchart is already destroyed.
  
Back to top
 
IP Logged
 
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Re: DropInDocVB problems
Reply #2 - Jun 4th, 2011 at 11:29pm
Print Post  
fcxWindow is the form where I put FlowChartX.

When I don't need the fcxWindow anymore I call fcx:EndWindow(). This way the dynamic memory and resources used by fcxWindow are marked as free and usable again. If the program needs to allocate some more dynamic memory, it uses the so called "Garbage Collector" to clear the memory marked as free, so it can be used by some other process.

Usualy the "Garbage Collector" is only called in low memory situations, like after a long run with several operations that require dynamic memory allocation, and that's why I didn't noticed it before.

I don't keep external references to fcx objects outside fcxWindow, and I don't create objects in event methods. If I don't drag anything over fcxWindow, EndWindow works fine and the memory is freed. However if I drag whatever over it the program crashes with an error in FlowChartPro.dll when calling fcxWindow:EndWindow(), even if I don't use the drag/drop events.

So, I'm sure it's something related with DragDrop, but I can't figure out what.

The (empty) method I use to catch the DragOver event:

method DiagramDragOverDocVB(DataObj, DocX, DocY, KeyState, Effect) class Database
return nil


The problem starts as soon as I define this method and drag something over fcxWindow. As you can see I don't do nothing, just return from it. I can use Drag&Drop with any other window/control.

However, if I make DragDropMode := drProgrControl instead of drProgrControlVB and strip out the "VB" from the method everything works fine again.
  
Back to top
 
IP Logged
 
Carlos_Rocha
Junior Member
**
Offline


I love Jazz

Posts: 70
Joined: Mar 26th, 2010
Re: DropInDocVB problems
Reply #3 - Jun 5th, 2011 at 12:21am
Print Post  
Just to add that I just wrapped fcx in VB6 to change the *VB events to pass a string to my side - IVBDataObject.GetData(1). No more crashes and everything works as expected.

So it seems that there's something wrong with IVBDataObject. I don't exclude the chance of beeing my environment that causes the troubles, but It would be the first COM object that raises this kind of exception.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint