OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: BazzaCAD on April 17, 2014, 10:29:15 AM

Title: Annoying TreeControl_OnItemExpanding bug
Post by: BazzaCAD on April 17, 2014, 10:29:15 AM
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]

Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: owenwengerd on April 17, 2014, 12:35:19 PM
Is the form's Event Invoke property set to Synchronous or Asynchronous?
Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: BazzaCAD on April 17, 2014, 01:19:19 PM
The form's is: Synchronous
The Tree control is: Asynchronous
Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: owenwengerd on April 17, 2014, 05:42:48 PM
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.
Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: owenwengerd on April 17, 2014, 07:40:57 PM
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.
Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: BazzaCAD on April 18, 2014, 03:32:21 PM
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?
Title: Re: Annoying TreeControl_OnItemExpanding bug
Post by: owenwengerd on April 18, 2014, 05:34:00 PM
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.