Fix null-deref when APZ is disabled and using out-of-process compositing. (bug 1305198, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Sat, 24 Sep 2016 13:10:12 -0700
changeset 315236 5880da58e1447162590d06196a875bb373aafe0c
parent 315235 71f595be2820bd86c76863b55bf2ce05ed702eb5
child 315237 27b9a320f8d7b7a573a847a9e9db3c657fa4ec88
push id32563
push userihsiao@mozilla.com
push dateMon, 26 Sep 2016 11:18:33 +0000
treeherderautoland@eb840c87b5fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1305198
milestone52.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
Fix null-deref when APZ is disabled and using out-of-process compositing. (bug 1305198, r=kats)
gfx/ipc/RemoteCompositorSession.cpp
--- a/gfx/ipc/RemoteCompositorSession.cpp
+++ b/gfx/ipc/RemoteCompositorSession.cpp
@@ -20,17 +20,19 @@ RemoteCompositorSession::RemoteComposito
                                                  CompositorWidgetDelegate* aWidgetDelegate,
                                                  APZCTreeManagerChild* aAPZ,
                                                  const uint64_t& aRootLayerTreeId)
  : CompositorSession(aWidgetDelegate, aChild, aRootLayerTreeId),
    mWidget(aWidget),
    mAPZ(aAPZ)
 {
   GPUProcessManager::Get()->RegisterSession(this);
-  mAPZ->SetCompositorSession(this);
+  if (mAPZ) {
+    mAPZ->SetCompositorSession(this);
+  }
 }
 
 RemoteCompositorSession::~RemoteCompositorSession()
 {
   // This should have been shutdown first.
   MOZ_ASSERT(!mCompositorBridgeChild);
 }
 
@@ -74,17 +76,19 @@ RemoteCompositorSession::GetAPZCTreeMana
 {
   return mAPZ;
 }
 
 void
 RemoteCompositorSession::Shutdown()
 {
   mContentController = nullptr;
-  mAPZ->SetCompositorSession(nullptr);
+  if (mAPZ) {
+    mAPZ->SetCompositorSession(nullptr);
+  }
   mCompositorBridgeChild->Destroy();
   mCompositorBridgeChild = nullptr;
   mCompositorWidgetDelegate = nullptr;
   mWidget = nullptr;
   GPUProcessManager::Get()->UnregisterSession(this);
 }
 
 } // namespace layers