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
--- 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(