LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

InsertTreeItem cause fatal run time error

Run into this weird problem.  The inherited code has ~ 10 thousand lines.

 InsertTreeItem(panel, TREE, .............., NULL);

causes crash ONLY in debug version !  not in release version.

The Tree is defined as an "int", the last parameter (NULL) is invalid, so crash make sense.  But ONLY in debug version ?!  How could this happen ?

From customer point of view, don't fix it if not broken (and I am not paid to fix bugs.  It's a hardware upgrade project.);

from developer point of view, I can't debug this file if not fixed.

 

 

George Zou
0 Kudos
Message 1 of 5
(3,088 Views)

Not sure why it does not crash in the executable, but that line appears a bit strange: supposing TREE is the name of the tree control, the correct way of addressing it shuld be

 InsertTreeItem(panel, PANEL_TREE, .............., NULL);


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,046 Views)

Thanks for reply.

There are several panels in that .uir file.  So it's not just PANEL_TREE.

To simplify the I change it to TREE when post.  The problem is the last parameter: NULL.

Fatal Run-Time error.jpg

 

 

George Zou
0 Kudos
Message 3 of 5
(3,029 Views)

Typecast to int will stop the crash, but fix all instances ?

 

George Zou
0 Kudos
Message 4 of 5
(3,025 Views)

NULL is not necessarily an error: like any other control that accepts tag/value elements, it can have several value types; NULL can be a valid item value for a tree which accepts strings or pointers.

 

Screenshot 2017-04-25 10.09.29.png

You could fix your problem simpy changing tree settings instead of several lines of code, if it matches how the value elements is expected to be used.

 

Nevertheless, if this is exactly the code the executable is build upon and the UIR it is using, it should crash as well: could you be using a different code/UIR?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(3,016 Views)