In my C application, I have a child thread that retrieve a IUnknown interface at beginning of his life :
static struct IUnknown* punk = NULL;
void DispatcherStart(){
CoInitialize(NULL);
CheckHRESULT(GetActiveObject(&MY_CLSID,NULL,&punk));
}
everything is fine, it's used to invoke some activeX functions and it work ! however, when my program end, it ask the thread to terminate, so my thread call is ending function's :
void DispatcherStop(){
if(punk) (punk)->lpVtbl->Release(punk); // BLOCK here
punk = NULL;
CoUninitialize();
}
my thead never return because Release on my IUnknow ptr block it. (if I remove the Release then the COUnitialize() block too)
What I am doing wrong ? (the punk iniatilisation can't be done in main thread)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…