NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

release step reference acquired by GetStepByName

Solved!
Go to solution
Hi,

I get a reference to a step object by calling GetStepByName. The help says, "release reference to object when you are done". However it is not told how to release it. I cannot find a function like ReleaseStep in the API. Same holds for GetSequenceByName. Is there a global function for releasing such objects?

I use GetSequenceFile in the same application and I can release its reference using ReleaseSequenceFile. However, there is not an equivalent function for releasing step and sequence references, or at least I couldn't find it.

I am currently working on customer site and appreciate any quick responses.

Cheers..
S. Eren BALCI
IMESTEK
0 Kudos
Message 1 of 4
(4,279 Views)

I'm not sure what language you are developing in or if you are making the API calls from a statement in TestStand.

 

In TestStand you shouldn't need to release anything except when you call the sequence file method.

 

In LabVIEW you can use the Close Reference function.  Found on the Application Control pallett.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 4
(4,270 Views)
Solution
Accepted by topic author ebalci

TestStand uses COM objects and GetStepByName function return a COM object.

"release reference to object when you are done" should be done by using IUnknown::Release function of the COM object.

 

Sequence file object reference returned by GetSequenceFile is a special case where you need to call both ReleaseSequenceFile and IUnknown::Release function.

 

However, in many languages, there exists a smart class which acts as a wrapper for the underlying COM object.Ex: CComPtr.  These smart classes will do the work of calling Release function and you dont have to expliclity call IUnknown::Release.

 

Also note that, if you are using GetStepByName, GetSequenceFile or GetSequenceByName in TestStand expression and storing the reference in an instance of Object Reference type variable, you need not call IUnknown::Release function since TestStand automatically calls IUnknown::Release for you.

 

 

- Shashidhar

0 Kudos
Message 3 of 4
(4,269 Views)
Thank you for your comments.
You're right, I forgot to tell you about the context.
I am calling API functions from an Action step type with ActiveX adapter.
I am -partially- relieved that TS handles the release itself.

Now I have to figure out why I get the pop-up message about unreleased object references while closing TS. It was reporting 3 unreleased references, so I thought they are the step, sequence and file references. But apparently that's not so.

I will open another thread for the pop-up message.
S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 4
(4,250 Views)