Porblem with thread handle leaks when firing events!
I have a problem that I can't seem to resolve. I have an ActiveX
control written with ATL.
The problem is that when I fire an event from within PThread that I
have created everything works fine but it leaks 2 thread handles each
time. The thread exits OK though. If fire the event without the
PThread then it works fine without the leaky handles. The only problem
is that for some reason I cannot call other functions from within the
COM from the client code.
Any body got any ideas what is leaking and how to get around it?
The relevant code is:
ReceivedCallThreadParams *pParams = new
ReceivedCallThreadParams(GetCallToken(), caller, e164Number);
void conn::FireReceivedCall(PThread &, INT param)
HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ReceivedCallThreadParams *pParams =
delete pParams; //
lets not leak
void CH323::fire_ReceivedCall(const PString & token , const PString &
remoteUserName, const PString & calledNumber)
// need to marshall to other thread now
hr = AtlUnmarshalPtr(m_MarshallStream, IID_IH323,
tProxy = (IH323*)NULL;
STDMETHODIMP CH323::TriggerEvent_CallReceived(BSTR Token, BSTR
RemoteUserName, BSTR CalledNumber)
Fire_ReceivedCall(Token, RemoteUserName, CalledNumber);