From 7ecc928aa6a87895ec879e051c3032db5029f129 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Sat, 24 Feb 2001 00:31:08 +0000 Subject: [PATCH] check to see if numframes > 1 --- modules/libpr0n/src/imgRequest.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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);