NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

close reference from a Derived Class from PropertyObject Class inside a callback.vi

Hi,

 

In LabVIEW I have implemented an operator interface based on the SimpleOI. Currently I'm getting -17501 and -17502 errors and a engine closing message when I want to run the operator interface again after a exit. Therefor I'm now looking closer to the code to see if all references to objects are closed correctly. I made a Callback vi who redirects UImessageEvents to UserEvents handled by the eventstructure inside the main loop.

 

 

 

screenshot.20.png  

According to the document "Using LabVIEW and LabWindows/CVI with TestStand" chapter 9 "Using the TestStand ActiveX APIs in LabVIEW" Paragraph "Acquiring a derived Class from a PropeertyObject Class" (page 9-6) I have to close the Reference to the propertyObject. But when I implement it this way (enabeling the case in the code shown above) LabVIEW freezes ("hang up") and I have to stop it using the Windows TaskManager.

This is a screenshot from the manual I mentioned above:

screenshot.21.png

I guess it has something to do with the fact that the code is inside a callback. How should I close the reference to the propertyObject? Or does LabVIEW close this reference automatically when the calback vi is ready with executing ?

 

Thanks,

Roger

 

0 Kudos
Message 1 of 5
(3,341 Views)

Hi,

 

The normal practices is to close any references that are created in the code module but don't close any that are passed into the Code Module such as the SequenceContext because the TestStand Engine will release this when its done with it.

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 5
(3,335 Views)

Hi,

 

Maybe what is happen is your reference is being closed by the closing of the VI before you have had a chance to use it.

Try following the Duplicating COM References in LabVIEW Code Modules section to keep hold of your object.

 

Regards
Ray Farmer
Message 3 of 5
(3,333 Views)

Hi Ray,

 

A little late reaction but still thanks for the answers. The project is still busy and I hadn't the time to look deeper into this problem. Mainly because the workaround works (i.e.. LabVIEW doesn't crash/freeze) but I foresee memory leaks when the operator interface is running  for a longer time. I gonna try your purposed solution (Duplicating COM References) when I'm having some time in this project (or when I experience some serious memory leaks 😉

 

Regards

-Roger

0 Kudos
Message 4 of 5
(3,303 Views)

Roger -

 

First off, I'm not sure I understand why you've designed your callback VI in this way? You are type casting a UIMessage to a PropertyObject, then type casting the PropertyObject back to a UIMessage in order to send it to a LabVIEW User Event. Couldn't you just skip the in between steps and directly pass the original UIMessage reference to your LabVIEW User Event.

 

Regardless of that, I believe you're experiencing the hang because you're closing the original UIMessage reference. In your code, you have 2 close reference VIs, one for the PropertyObject reference and one for the original UIMessage reference. TestStand automatically closes/releases the UIMessage reference acquired from the Unbundle By Name function once all other references to the UIMessage have been closed/released so you do not need to close the original UIMessage reference.

 

I would remove the Close Reference for the original UIMessage reference and then replace the Close Reference for the PropertyObject reference. Are you closing the UIMessage reference that you pass to the LabVIEW User Event once you're done using it in the Event Structure?

Manooch H.
National Instruments
0 Kudos
Message 5 of 5
(3,223 Views)