Fix dangling nsIWidget pointer in ClientLayerManager. (bug 1319213, r=mattwoodrow)
authorDavid Anderson <danderson@mozilla.com>
Tue, 22 Nov 2016 11:36:45 -0800
changeset 323865 25dbaa4741412f9f4757553c2762e00e8ed0d09d
parent 323864 770ce0c52559d994559ad45ed5c05853be1700a1
child 323866 4e6fc50106d39c1c57555f7bdda8e336ba8a91b3
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersmattwoodrow
bugs1319213
milestone53.0a1
Fix dangling nsIWidget pointer in ClientLayerManager. (bug 1319213, r=mattwoodrow)
gfx/layers/client/ClientLayerManager.cpp
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -141,16 +141,19 @@ ClientLayerManager::Destroy()
     RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
     uint64_t id = mLatestTransactionId;
 
     RefPtr<Runnable> task = NS_NewRunnableFunction([allocator, id] () -> void {
       allocator->NotifyTransactionCompleted(id);
     });
     NS_DispatchToMainThread(task.forget());
   }
+
+  // Forget the widget pointer in case we outlive our owning widget.
+  mWidget = nullptr;
 }
 
 int32_t
 ClientLayerManager::GetMaxTextureSize() const
 {
   return mForwarder->GetMaxTextureSize();
 }