From b70b6eb4539221c6216290523fd2a91aa94cfe9a Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Fri, 4 Aug 2017 13:21:06 -0400 Subject: [PATCH] Bug 1382335 - 4. Check for shutdown in more LayerViewSupport functions; r=esawin Check for shutdown so we don't crash on accessing a null window pointer. MozReview-Commit-ID: FRky4dcuhrw --- widget/android/nsWindow.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 90ff9205c1f5..31662ecb192e 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -365,7 +365,9 @@ public: : mWindow(aPtr, aWindow) , mNPZC(aNPZC) , mPreviousButtons(0) - {} + { + MOZ_ASSERT(mWindow); + } ~NPZCSupport() {} @@ -827,7 +829,9 @@ public: : mWindow(aPtr, aWindow) , mCompositor(aInstance) , mCompositorPaused(true) - {} + { + MOZ_ASSERT(mWindow); + } ~LayerViewSupport() {} @@ -859,6 +863,9 @@ private: void OnResumedCompositor() { MOZ_ASSERT(NS_IsMainThread()); + if (!mWindow) { + return; // Already shut down. + } // When we receive this, the compositor has already been told to // resume. (It turns out that waiting till we reach here to tell @@ -919,7 +926,9 @@ public: jni::Object::Param aSurface) { MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(mWindow); + if (!mWindow) { + return; // Already shut down. + } mSurface = aSurface; mWindow->CreateLayerManager(aWidth, aHeight);