Bug 538918 - Move Init() above mutex unlock - attempted test hang fix.
authorJim Mathies <jmathies@mozilla.com>
Thu, 11 Feb 2010 11:25:39 -0600
changeset 46661 570d05b8d634e7163adf669bf789aa27c4d37caa
parent 46660 2f9e351ca2b121bd9da5db03392f702395a27bd3
child 46662 a77022f7680c9486748abe5ddb55cb9af6686cea
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs538918
milestone1.9.3a2pre
Bug 538918 - Move Init() above mutex unlock - attempted test hang fix.
ipc/glue/WindowsMessageLoop.cpp
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -599,21 +599,21 @@ RPCChannel::IsMessagePending()
   return false;
 }
 
 bool
 SyncChannel::WaitForNotify()
 {
   mMutex.AssertCurrentThreadOwns();
 
-  MutexAutoUnlock unlock(mMutex);
-
   // Initialize global objects used in deferred messaging.
   Init();
 
+  MutexAutoUnlock unlock(mMutex);
+
   if (++gEventLoopDepth == 1) {
     NS_ASSERTION(!gNeuteredWindows, "Should only set this once!");
     gNeuteredWindows = new nsAutoTArray<HWND, 20>();
     NS_ASSERTION(gNeuteredWindows, "Out of memory!");
   }
 
   // Setup deferred processing of native events while we wait for a response.
   NS_ASSERTION(!SyncChannel::IsPumpingMessages(),
@@ -707,21 +707,21 @@ SyncChannel::WaitForNotify()
   return true;
 }
 
 bool
 RPCChannel::WaitForNotify()
 {
   mMutex.AssertCurrentThreadOwns();
 
-  MutexAutoUnlock unlock(mMutex);
-
   // Initialize global objects used in deferred messaging.
   Init();
 
+  MutexAutoUnlock unlock(mMutex);
+
   // IsSpinLoopActive indicates modal UI is being displayed in a plugin. Drop
   // down into the spin loop until all modal loops end. If SpinInternalEventLoop
   // returns true, the out-call response we were waiting on arrived, or we
   // received an in-call request from child, so return from WaitForNotify.
   // We'll step back down into the spin loop on the next WaitForNotify call.
   // If the spin loop returns false, the child's modal loop has ended, so
   // drop down into "normal" deferred processing until the next reply is
   // received. Note, spin loop can cause reentrant race conditions, which