NullReferenceException after __crt_dll_terminate
From: Dmitry Sazonov (sazonov_at_sig.com)
Date: 02/08/05
- Next message: moWhite: "Print Reserved Word?"
- Previous message: Sean Hederman: "Re: ref parameters default? intentional?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Feb 2005 06:07:51 -0800
My managed code calls unmanaded DLL.
I'm calling __crt_dll_initialize(); before any work and
calling __crt_dll_terminate before shutdown of my
application.
Here is a problem. I have managed class, which keep
pointer to unmanaged class. I decided to use Dispoe
pattern and descructor. So, my managed wrapper create and
delete unmanaged class. Everything works fine, until
application shutdown.
I'm calling __crt_dll_terminate. After that GC decide to
call my Finalizer, which tried to delete unmanaged
pointer. But, unmanaged heap already desctucted and I got
an exception.
How can I know what unmanaged heap alive?
thanks.
here is my code:
public __gc class Managed : public System::IDisposable
{
UnManagedClass* unmamaged;
public:
Managed() : tick(NULL)
{
unmamaged = new UnManagedClass();
}
~Managed()
{
Dispose();
}
void Dispose()
{
if( unmamaged != NULL )
{
delete unmamaged;
unmamaged = NULL;
}
}
}
- Next message: moWhite: "Print Reserved Word?"
- Previous message: Sean Hederman: "Re: ref parameters default? intentional?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|