Bug 1156182 - Ensure nsWindow::Destroy() is called before destroying mPresentLock to avoid a race with the compositor thread. r=Bas
authorNicolas Silva <nsilva@mozilla.com>
Thu, 02 Jul 2015 11:40:53 +0200
changeset 251134 65c580e2cb9baba37cca94f701742b442d77b0b0
parent 251133 51dc428a5250672e97231d7b36c937eeb7664bba
child 251135 18df6f749b478954463af2f339de4bef48ce7d9f
push id13833
push userryanvm@gmail.com
push dateThu, 02 Jul 2015 20:00:55 +0000
treeherderfx-team@98101796b275 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1156182
milestone42.0a1
Bug 1156182 - Ensure nsWindow::Destroy() is called before destroying mPresentLock to avoid a race with the compositor thread. r=Bas
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -404,21 +404,20 @@ nsWindow::nsWindow() : nsWindowBase()
   sInstanceCount++;
 }
 
 nsWindow::~nsWindow()
 {
   mInDtor = true;
 
   // If the widget was released without calling Destroy() then the native window still
-  // exists, and we need to destroy it. This will also result in a call to OnDestroy.
-  //
-  // XXX How could this happen???
-  if (nullptr != mWnd)
-    Destroy();
+  // exists, and we need to destroy it.
+  // Destroy() will early-return if it was already called. In any case it is important
+  // to call it before destroying mPresentLock (cf. 1156182).
+  Destroy();
 
   // Free app icon resources.  This must happen after `OnDestroy` (see bug 708033).
   if (mIconSmall)
     ::DestroyIcon(mIconSmall);
 
   if (mIconBig)
     ::DestroyIcon(mIconBig);