OSDN Git Service

* globals.cc (exit_status): Add new ES_EXIT_STARTING enum.
authorcgf <cgf>
Sun, 28 Mar 2010 17:27:52 +0000 (17:27 +0000)
committercgf <cgf>
Sun, 28 Mar 2010 17:27:52 +0000 (17:27 +0000)
* 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/ChangeLog
winsup/cygwin/dcrt0.cc
winsup/cygwin/dll_init.cc
winsup/cygwin/globals.cc

index d695f4b..66f84a4 100644 (file)
@@ -1,3 +1,11 @@
+2010-03-28  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * 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.
+
 2010-03-27  Corinna Vinschen  <corinna@vinschen.de>
 
        * nlsfuncs.cc (__set_charset_from_locale):  Set default charset for
index 6a1a341..76b8951 100644 (file)
@@ -1127,6 +1127,7 @@ cygwin_atexit (void (*fn) (void))
 extern "C" void
 cygwin_exit (int n)
 {
+  exit_state = ES_EXIT_STARTING;
   exit (n);
 }
 
index bd3d7d9..24d6d5c 100644 (file)
@@ -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)
index 5934a72..0baa96e 100644 (file)
@@ -30,6 +30,7 @@ int NO_COPY sigExeced;
 enum exit_states
   {
     ES_NOT_EXITING = 0,
+    ES_EXIT_STARTING,
     ES_PROCESS_LOCKED,
     ES_EVENTS_TERMINATE,
     ES_THREADTERM,