OLE32 Exception when shutting down my Service
I have a Service application that crashes only on one PC (Windows XP) when shutting down via Services.
I get the following error on WinDbg:
(1038.728): Access violation - code c0000005 (!!! second chance !!!)
eax=00000000 ebx=00000000 ecx=0018b7a4 edx=77606e00 esi=0016b7f8 edi=0018b7a4
eip=7750cdbd esp=0012fe78 ebp=0012fe84 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
...
ole32!StringFromCLSID+0x325
ole32!StringFromCLSID+0x2e7
ole32!StringFromCLSID+0x2c9
ole32!StringF开发者_如何转开发romCLSID+0x215
ole32!StringFromCLSID+0x38f
RPCRT4!IUnknown_Release_Proxy+0x11
mfc100+0x20a229
MSVCR100!exit+0x11
My code uses a COM/Ole database control of some form and I access it like this:
CoInitializeEx( 0, COINIT_MULTITHREADED );
IClientTable testCDS;
testCDS.CreateDispatch("ClientTableServer.ClientTable");
testCDS.ReleaseDispatch();
<Windows message loop>
CoUninitialize();
If I comment out the use of testCDS, there is no crash. I have tried combinations of ReleaseDispatch and DetachDispatch but I still get the same problem.
Help would be greatly appreciated. Thanks
Hmm. This wasn't as tricky as I thought - there was another usage of IClientTable buried inside a library and ReleaseDispatch() wasn't being called. Problem solved.
精彩评论