diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index ded69ba2fc67..8248ab07c70c 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -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 kungFuDeathGroup(this); + RefPtr 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 kungFuDeathGroup(this); + RefPtr 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 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 kungFuDeathGrip(this); + // Tell *our* observers that we're done loading. if (mProgressTracker) { Progress progress = FLAG_SIZE_AVAILABLE |