Bug 1308289 - Hold strong reference to VectorImage when dispatching ProgressTracker::SyncNotifyProgress. r=tnikkel

This commit is contained in:
Andrew Osmond 2016-10-13 08:35:55 -04:00
parent 5e4e74e859
commit be96e28a0f

View File

@ -153,7 +153,7 @@ public:
// OnSVGDocumentParsed will release our owner's reference to us, so ensure
// we stick around long enough to complete our work.
RefPtr<SVGParseCompleteListener> kungFuDeathGroup(this);
RefPtr<SVGParseCompleteListener> kungFuDeathGrip(this);
mImage->OnSVGDocumentParsed();
}
@ -212,7 +212,7 @@ public:
// OnSVGDocumentLoaded/OnSVGDocumentError will release our owner's reference
// to us, so ensure we stick around long enough to complete our work.
RefPtr<SVGLoadEventListener> kungFuDeathGroup(this);
RefPtr<SVGLoadEventListener> kungFuDeathGrip(this);
nsAutoString eventType;
aEvent->GetType(eventType);
@ -536,8 +536,8 @@ VectorImage::RequestRefresh(const TimeStamp& aTime)
mSVGDocumentWrapper->TickRefreshDriver();
if (mHasPendingInvalidation) {
SendInvalidationNotifications();
mHasPendingInvalidation = false;
SendInvalidationNotifications();
}
}
@ -1140,6 +1140,10 @@ VectorImage::OnStartRequest(nsIRequest* aRequest, nsISupports* aCtxt)
return rv;
}
// ProgressTracker::SyncNotifyProgress may release us, so ensure we
// stick around long enough to complete our work.
RefPtr<VectorImage> kungFuDeathGrip(this);
// Block page load until the document's ready. (We unblock it in
// OnSVGDocumentLoaded or OnSVGDocumentError.)
if (mProgressTracker) {
@ -1220,6 +1224,10 @@ VectorImage::OnSVGDocumentLoaded()
// Start listening to our image for rendering updates.
mRenderingObserver = new SVGRootRenderingObserver(mSVGDocumentWrapper, this);
// ProgressTracker::SyncNotifyProgress may release us, so ensure we
// stick around long enough to complete our work.
RefPtr<VectorImage> kungFuDeathGrip(this);
// Tell *our* observers that we're done loading.
if (mProgressTracker) {
Progress progress = FLAG_SIZE_AVAILABLE |