Bug 1266466 - Fix missing call to parent Destroy function in Android's nsWindow. r=snorp
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 21 Apr 2016 15:07:01 -0400
changeset 318146 d2670d2a634a3ee685da69395d43a18ebc965575
parent 318145 97a73074dc7cdf184edd8d615a6a0a2df20ab865
child 318147 a86e8abdc7db1bb3446855e1d8ceada375e461ba
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1266466
milestone48.0a1
Bug 1266466 - Fix missing call to parent Destroy function in Android's nsWindow. r=snorp MozReview-Commit-ID: 3LH098M8Mdh
widget/android/nsWindow.cpp
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1323,22 +1323,27 @@ nsWindow::Destroy(void)
 {
     nsBaseWidget::mOnDestroyCalled = true;
 
     if (mGeckoViewSupport) {
         // Disassociate our native object with GeckoView.
         mGeckoViewSupport = nullptr;
     }
 
+    // Stuff below may release the last ref to this
+    nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
+
     while (mChildren.Length()) {
         // why do we still have children?
         ALOG("### Warning: Destroying window %p and reparenting child %p to null!", (void*)this, (void*)mChildren[0]);
         mChildren[0]->SetParent(nullptr);
     }
 
+    nsBaseWidget::Destroy();
+
     if (IsTopLevel())
         gTopLevelWindows.RemoveElement(this);
 
     SetParent(nullptr);
 
     nsBaseWidget::OnDestroy();
 
 #ifdef DEBUG_ANDROID_WIDGET