From 4c6dbce80d7d98b7016d4dbe0900450d6cc95740 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 21 Apr 2016 15:07:01 -0400 Subject: [PATCH] Bug 1266466 - Fix missing call to parent Destroy function in Android's nsWindow. r=snorp MozReview-Commit-ID: 3LH098M8Mdh --- widget/android/nsWindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index e6fd568bf4b0..2386d3c06283 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -1328,12 +1328,17 @@ nsWindow::Destroy(void) mGeckoViewSupport = nullptr; } + // Stuff below may release the last ref to this + nsCOMPtr 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);