Bug 1156182 - Ensure nsWindow::Destroy() is called before destroying mPresentLock to avoid a race with the compositor thread. r=Bas, a=lmandel
authorNicolas Silva <nsilva@mozilla.com>
Thu, 02 Jul 2015 11:40:53 +0200
changeset 273773 738fc6e538261339fe007dd8cbd0122aced7f942
parent 273772 e64d63dd4b4d09c380c64dd85674fb014a3dee2d
child 273774 354567baa2aab8571433742f686c51cb826408fc
push id4861
push userryanvm@gmail.com
push dateThu, 09 Jul 2015 18:16:43 +0000
treeherdermozilla-beta@93c0c5e4ec30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lmandel
bugs1156182
milestone40.0
Bug 1156182 - Ensure nsWindow::Destroy() is called before destroying mPresentLock to avoid a race with the compositor thread. r=Bas, a=lmandel
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -410,21 +410,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);