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 334233 d2670d2a634a3ee685da69395d43a18ebc965575
parent 334232 97a73074dc7cdf184edd8d615a6a0a2df20ab865
child 334234 a86e8abdc7db1bb3446855e1d8ceada375e461ba
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1266466
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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