NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Release Engine-Object in COM-Server?

Hello,

I'm writing a COM-Server (VC++, ATL) which uses among other things the
Teststand Engine-Object. Creating the engine and using it is no problem,
but if I release the engine I get an exception when my COM-Server is released.
If I do not call engine->Release() this does not happen. I've written a dummy
COM-Server, which only creates the engine in one function an releases it in
another function. When debugging it with a VB-Script I get an access violation
upon the release of the COM-Server if engine->Release() is called.

STDMETHODIMP CClass::Start()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState())
    HRESULT hr;
    // Load TestStand Engine
    hr = engine.CreateInstance("TestStand.Engine");
    return S_OK;
}

STDMETHODIMP CTest::Close()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState())
    HRESULT hr;
    hr = engine->Release();
    return S_OK;
}


Do I have to release the engine object programatically? Is there a description
of an object release schedule, which tells me when and how to release Teststand
objects?

Thank you.
Mike
0 Kudos
Message 1 of 2
(2,933 Views)

have you tried calling

engine.ShutDown(true)

before closing the reference?

 

 

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