Bug 1369298 - Prevent AndrodDynamicToolbarAnimator from getting Initialized if compositor is being shutdown r=botond
MozReview-Commit-ID: 5N7bKyaXzPH
--- a/gfx/layers/ipc/UiCompositorControllerParent.cpp
+++ b/gfx/layers/ipc/UiCompositorControllerParent.cpp
@@ -260,17 +260,22 @@ UiCompositorControllerParent::Initialize
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
AddRef();
LayerTreeState* state = CompositorBridgeParent::GetIndirectShadowTree(mRootLayerTreeId);
MOZ_ASSERT(state);
MOZ_ASSERT(state->mParent);
state->mUiControllerParent = this;
#if defined(MOZ_WIDGET_ANDROID)
- state->mParent->GetAPZCTreeManager()->InitializeDynamicToolbarAnimator(mRootLayerTreeId);
+ RefPtr<APZCTreeManager> manager = state->mParent->GetAPZCTreeManager();
+ // Since this is called from the UI thread. It is possible the compositor has already
+ // started shutting down and the APZCTreeManager could be a nullptr.
+ if (manager) {
+ manager->InitializeDynamicToolbarAnimator(mRootLayerTreeId);
+ }
#endif
}
void
UiCompositorControllerParent::Open(Endpoint<PUiCompositorControllerParent>&& aEndpoint)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (!aEndpoint.Bind(this)) {