Annoying TreeControl_OnItemExpanding bug

Started by BazzaCAD, April 17, 2014, 10:29:15 AM

Previous topic - Next topic

BazzaCAD

OK I've been chasing this bug for months now.
The prob. is 99% of the time the code run fine.
Only about once or twice a week across 30 users does the bug pop up.

I keep getting this invalid argument type for my tree control (see attached pic).
I've added this debug code:

Code (autolisp) Select

(defun c:MainTMaCAD_TreeControl_OnItemExpanding (ItemText Key /  x n1 tpkey rValue PathList CurrectKey ParentKey SubFolders KidKey ParKey)
  (if DEBUG
    (progn
    (princ "\nRunning TreeControl_OnItemExpanding... ")
  (princ "\nItemText: ")
      (princ ItemText)     
  (princ "\nKey: ")
      (princ Key)  ;<--- Crashing here
    )
  );_ if

(if (dcl_Tree_IsItemExpanded TMaCAD_MainTMaCAD_TreeControl Key) ;<--- Crashing here, if DEBUG is off
.......


The output I get is:

Running TreeControl_OnItemExpanding...
ItemText: 13081
Key: 2.1868e+009; error: ADS request error


When the code is working 99% of the time I get, something like this:

Running TreeControl_OnItemExpanding...
ItemText: 13081
Key: 833029504


What is wrong with the key? Is this a memory addressing issue?
OpenDCL Runtime [7.0.1.2]

a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Is the form's Event Invoke property set to Synchronous or Asynchronous?
Owen Wengerd (Outside The Box) / ManuSoft

BazzaCAD

The form's is: Synchronous
The Tree control is: Asynchronous
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

Asynchronous calls require the event handler arguments to be passed as strings, so I suspect that has something to do with it. I'll have a look at the code to see if I can figure out how your observed behavior might happen.
Owen Wengerd (Outside The Box) / ManuSoft

owenwengerd

I'm pretty sure the problem you see is due to sufficiently large handle values causing the argument to become a floating point value, which is then rejected as a valid handle when using it to call back into OpenDCL. The problem should now be fixed in the next build.
Owen Wengerd (Outside The Box) / ManuSoft

BazzaCAD

Thanks Owen.
I guess I should have posted earlier.
I've been trying to narrow this down to something in my code. ;-)
What is making the handles values to become large?
The number of items in the tree?
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

owenwengerd

A handle is essentially a pointer to something in memory, so it just depends where the memory happens to get allocated. I doubt that the number of items has any noticeable effect.
Owen Wengerd (Outside The Box) / ManuSoft