Commit 8a5f8937 authored by Alexandre Julliard's avatar Alexandre Julliard

Make sure to always call the destructors when the constructors have

been called from the dll entry point.
parent 50cce6b6
......@@ -28,13 +28,18 @@ extern BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved );
BOOL WINAPI __wine_spec_dll_entry( HINSTANCE inst, DWORD reason, LPVOID reserved )
{
BOOL ret, needs_init = (__wine_spec_init_state != CONSTRUCTORS_DONE);
static BOOL call_fini;
BOOL ret;
if (reason == DLL_PROCESS_ATTACH && needs_init)
if (reason == DLL_PROCESS_ATTACH && __wine_spec_init_state != CONSTRUCTORS_DONE)
{
call_fini = TRUE;
_init( __wine_main_argc, __wine_main_argv, __wine_main_environ );
}
ret = DllMain( inst, reason, reserved );
if (reason == DLL_PROCESS_DETACH && needs_init) _fini();
if (reason == DLL_PROCESS_DETACH && call_fini) _fini();
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment