NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

My Sequence Editor is crashing

Hello
 
Have written a c++ dll function whitch is used in the model. In the function i get pointer to the Execution via SequenceContext.
 
ExecutionPtr pExecution = m_pContext->Execution;
// Now do some stuff 
pExecution->Release();
 
In the Operater Interface this works well, because the helpfile said:

Execution Property (Read Only)
Syntax
SequenceContext.Execution
Data Type
Execution
Purpose
Returns a reference to the currently executing execution. Release your reference to this object when you are done using it.

if i delete:  pExecution->Release(); The sequence editor works too:
That means the Editor is using this reference, too.

Please tell me where will this object bereleased?

Greetings from the lake of constance, Germany

juergen

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 1 of 2
(2,997 Views)

It looks like you are using the TestStand API via a #import generated C++ wrapper.  This is probably the best way to use any COM server in C++, but you need understand that the types that you use are C++ smart pointers.  For example, the local variable of type "ExecutionPtr" is a C++ smart pointer class that will automatically release the reference it holds when it goes out of scope, which is a nice feature!. Thus, you shouldn't call Release directly, because then it will be called twice.

If you are curious, the implementation of the COM smart pointers for #import wrappers can ultimately be found in the _com_ptr_t class which is in your copy of Program Files\Microsoft Visual Studio 8\VC\Include\comip.h file.

 

0 Kudos
Message 2 of 2
(2,980 Views)