My app (EasyJob) causes an access violation error on exiting. This only happens on some systems, mostly Vista, but it has happened on some XP boxes. The application is written in VB6.
After finding a system that shows this behavior, I ran DebugDiag on my process and got this report:
Function Arg1 Arg2 Arg3 0x04246c81 726c7fc8 778bf188 0012fea4 ole32!CoDisconnectObject+55 726c7fc8 00000000 00000002 msvbvm60!BASIC_CLASS_Release+10b2d 00000002 013e07cc 727ae518 msvbvm60!TipUnloadProject+df2 013e08dc 013e07cc 727ae470 msvbvm60!EbResetProjectNormal+1a54 00000000 00000000 00000000
In easyjobpro__PID__5240__Date__05_18_2009__Time_09_24_01PM__619__Second_Chance_Exception_C0000005.dmp the module C:\Windows\System32\ole32.dll has caused an access violation exception (0xC0000005) when trying to write to memory location 0x726c7fc8 on thread 0
OK, so it looks like it's OLE32.dll that is causing this, but how can I fix it???? O:-)
Is there a way to get a longer stack trace so I can actually see what part of my code started this thing? It seems to be related with some class being unloaded (BASIC_CLASS_Release), but how do I find out which one?
Anybody knows why this might be happening mostly on Vista?
This stuff is driving me nuts, so ANY help would be GREATLY appreciated. Seriously, I'll buy you a beer no matter where you are. O:-)
GPF on exit is usually caused by wrong deinitialization sequence. For example, the following could have happened: some code that releases all objects has been called already and now you have a dangling pointer and the code currently executing is trying to release the same object. Since the object is no longer there you get a GPF.
Such situations are usually hard to debug. What you need is a dedicated deinitialization where you would disconnect, finalize, flush, close, etc. all objects that you initialized while running the program. In most cases all you need is to just set the pointet to the object to Nothing
- built-in resource management will have the object properly deinitialized. You have to execute this code before the whole program termination starts - somewhere like when closing the main window.