observe-before-thread-shutdown
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 66 4161d51d7ccbb4019a5cb4d18a855094024a52db
permissions -rw-r--r--
State as of now

diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -735,13 +735,6 @@ NS_ShutdownXPCOM(nsIServiceManager* serv
 
         NS_ProcessPendingEvents(thread);
 
-        // Shutdown all remaining threads.  This method does not return until
-        // all threads created using the thread manager (with the exception of
-        // the main thread) have exited.
-        nsThreadManager::get()->Shutdown();
-
-        NS_ProcessPendingEvents(thread);
-
         // We save the "xpcom-shutdown-loaders" observers to notify after
         // the observerservice is gone.
         if (observerService) {
@@ -751,6 +744,14 @@ NS_ShutdownXPCOM(nsIServiceManager* serv
 
             observerService->Shutdown();
         }
+
+
+        // Shutdown all remaining threads.  This method does not return until
+        // all threads created using the thread manager (with the exception of
+        // the main thread) have exited.
+        nsThreadManager::get()->Shutdown();
+
+        NS_ProcessPendingEvents(thread);
     }
 
     // XPCOM is officially in shutdown mode NOW