diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp index b64d28ddf9bd..f45d9f5a8c72 100644 --- a/modules/libpr0n/src/imgRequest.cpp +++ b/modules/libpr0n/src/imgRequest.cpp @@ -100,7 +100,7 @@ nsresult imgRequest::AddObserver(imgIDecoderObserver *observer) if (mObservers.Count() == 1) { PRUint32 nframes; mImage->GetNumFrames(&nframes); - if (nframes > 0) { + if (nframes > 1) { PR_LOG(gImgLog, PR_LOG_DEBUG, ("[this=%p] imgRequest::AddObserver -- starting animation\n", this)); @@ -121,7 +121,7 @@ nsresult imgRequest::RemoveObserver(imgIDecoderObserver *observer, nsresult stat if (mImage) { PRUint32 nframes; mImage->GetNumFrames(&nframes); - if (nframes > 0) { + if (nframes > 1) { PR_LOG(gImgLog, PR_LOG_DEBUG, ("[this=%p] imgRequest::RemoveObserver -- stopping animation\n", this)); @@ -164,6 +164,17 @@ NS_IMETHODIMP imgRequest::Cancel(nsresult status) ImageCache::Remove(mURI); + if (mImage) { + PRUint32 nframes; + mImage->GetNumFrames(&nframes); + if (nframes > 1) { + PR_LOG(gImgLog, PR_LOG_DEBUG, + ("[this=%p] imgRequest::RemoveObserver -- stopping animation\n", this)); + + mImage->StopAnimation(); + } + } + if (mChannel && mProcessing) return mChannel->Cancel(status);