Fix dangling nsIWidget pointer in ClientLayerManager. (bug 1319213, r=mattwoodrow,a=gchang)
authorDavid Anderson <danderson@mozilla.com>
Tue, 22 Nov 2016 11:36:45 -0800
changeset 353327 236b90305efbbc79f66ca1453be47f3688b26c7a
parent 353326 ac4036813ff1e26bf75e646053074d7b70b77553
child 353328 e21cb1f2f254bba6410fb3951a5b565238a501b3
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, gchang
bugs1319213
milestone52.0a2
Fix dangling nsIWidget pointer in ClientLayerManager. (bug 1319213, r=mattwoodrow,a=gchang)
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();
 }