Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

LabVIEW UserInterface gives PropertyObject Warnings when using UIMessages

Primary Software: TestStand
Primary Software Version: 3.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Base Package

Problem:

I have a LabVIEW UserInterface (UI) that handles UIMessages that pass a PropertyObject from TestStand to LabVIEW via the ActiveX parameter of the UIMessage.  When I shut down my UI, I receive a warning that I have PropertyObjects that were not released:

References to PropertyObjects were not released properly.

How can I prevent this warning from appearing?



Solution:

To prevent this warning from happening, you will need to change how your LabVIEW UI handles your UIMessages.  This warning is happening because of the way that LabVIEW handles variants.

When LabVIEW has an variant wire, the memory for that data is not freed until the VI leaves memory.  Because your UIMessage callback is registered for an event, it will not be unloaded until your top-level VI is unloaded.  When the TestStand Engine shuts down, your top-level VI has not completed yet.  So the TestStand engine still has open PropertyObject references, and gives the warning.

To prevent this, you must unload the VI that handles your UI Message when it is done using the PropertyObject.  You can do this by calling the VI dynamically from the UIMessage Callback.  So instead of one VI that is registered to the callback handling the UIMessage, you instead create a callback VI that dynamically calls a second VI that then handles the callback.

The callback VI might be something like:

Note that this VI opens a reference to the VI  dynamically, calls the VI by reference, and then closes the VI reference.  By closing the VI reference when there are no other items using it, LabVIEW will automatically unload the VI, causing the ActiveX data to be unloaded.

If the VI is being used anywhere else, it will not be unloaded.  This is very important!  For instance, if you have the VI open for editing, LabVIEW will not close the reference, and you will still experience PropertyObject leak warnings.

Attached, you can find three VIs that demonstrate the proper procedure for handling the ActiveX property of a UIMessage in LabVIEW.



Related Links:

Attachments:

Configure Event CallbacksSimple OI - Configure Event Callbacks.vi
UserMessage CallbackSimple OI - UserMessage Event Callback.vi
Dynamic UserMessage HandlerDynamic UserMessage Callback.vi






Report Date: 01/07/2008
Last Updated: 01/07/2008
Document ID: 4H6DULT3

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit