From c019a66c32f8575c85524e4fb889d79093acee56 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 28 Mar 2010 17:27:52 +0000 Subject: * globals.cc (exit_status): Add new ES_EXIT_STARTING enum. * dcrt0.cc (cygwin_exit): Set exit_state to ES_EXIT_STARTING prior to calling real exit. * dll_init.cc (dll_list::detach): Remove dll from linked list and call destructors even if exiting. Don't call __cxa_finalize in exiting case. --- winsup/cygwin/dll_init.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/dll_init.cc') diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index bd3d7d996..24d6d5c5f 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -164,7 +164,7 @@ void dll_list::detach (void *retaddr) { dll *d; - if (!myself || exit_state || !(d = find (retaddr))) + if (!myself || !(d = find (retaddr))) return; if (d->count <= 0) system_printf ("WARNING: trying to detach an already detached dll ..."); @@ -172,7 +172,9 @@ dll_list::detach (void *retaddr) { /* Ensure our exception handler is enabled for destructors */ exception protect; - __cxa_finalize (d); + /* Call finalize function if we are not already exiting */ + if (!exit_state) + __cxa_finalize (d); d->run_dtors (); d->prev->next = d->next; if (d->next) -- cgit v1.2.3