Bug 1704876 - Fix a shutdown crash when we race to update an animated vector image. r=tnikkel

If we are shutting down, the document for a VectorImage may be cleared.
If a refresh tick raced with the shutdown, we might try to deref the
null document.

Differential Revision: https://phabricator.services.mozilla.com/D132953
This commit is contained in:
Andrew Osmond 2021-12-07 03:10:10 +00:00
parent 00d79258e2
commit 90fb928d6b

View File

@ -481,8 +481,13 @@ VectorImage::RequestRefresh(const TimeStamp& aTime) {
return;
}
PendingAnimationTracker* tracker =
mSVGDocumentWrapper->GetDocument()->GetPendingAnimationTracker();
Document* doc = mSVGDocumentWrapper->GetDocument();
if (!doc) {
// We are racing between shutdown and a refresh.
return;
}
PendingAnimationTracker* tracker = doc->GetPendingAnimationTracker();
if (tracker && ShouldAnimate()) {
tracker->TriggerPendingAnimationsOnNextTick(aTime);
}