Bug 1364525 - Handle null-pointer dereference condition. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 19 May 2017 10:37:52 -0400
changeset 581199 03ca0bea4d4abeb4853926720777f318f3e4253e
parent 581198 22d801f9bf5c2877e754f4e85f34f74cbf19061a
child 629523 2bec59081114a5859a79291ddbde5a436ff033a0
push id59812
push userkgupta@mozilla.com
push dateFri, 19 May 2017 14:38:46 +0000
reviewersbotond
bugs1364525
milestone55.0a1
Bug 1364525 - Handle null-pointer dereference condition. r?botond This is a pre-existing bug that I ran into while exercising the async scrollbar code on OS X. The LayerTreeState might not be available, so we detect and skip those layers. MozReview-Commit-ID: 9MMEVKKMo8u
gfx/layers/apz/src/APZCTreeManager.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -399,20 +399,25 @@ APZCTreeManager::PushStateToWR(wr::WebRe
           return;
         }
         AsyncPanZoomController* apzc = aNode->GetApzc();
         MOZ_ASSERT(apzc);
 
         if (aNode->GetLayersId() != lastLayersId) {
           // If we walked into or out of a subtree, we need to get the new
           // pipeline id.
+          const LayerTreeState* state = CompositorBridgeParent::GetIndirectShadowTree(aNode->GetLayersId());
+          if (!(state && state->mWrBridge)) {
+            // During shutdown we might have layer tree information for stuff
+            // that has already been torn down. In that case just skip over
+            // those layers.
+            return;
+          }
+          lastPipelineId = state->mWrBridge->PipelineId();
           lastLayersId = aNode->GetLayersId();
-          const LayerTreeState* state = CompositorBridgeParent::GetIndirectShadowTree(lastLayersId);
-          MOZ_ASSERT(state && state->mWrBridge);
-          lastPipelineId = state->mWrBridge->PipelineId();
         }
 
         // Use a 0 presShellId because when we do a lookup in this map for the
         // scrollbar below we don't have (or care about) the presShellId.
         ScrollableLayerGuid guid(lastLayersId, 0, apzc->GetGuid().mScrollId);
         httnMap.insert(std::make_pair(guid, aNode));
 
         ParentLayerPoint layerTranslation = apzc->GetCurrentAsyncTransform(