From 2da30889d098a19534da400bb3528a28f2d63d81 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Tue, 18 Aug 1998 01:43:35 +0000 Subject: [PATCH] Changed destructor to Interrupt() image group before realeasing reference git-svn-id: svn://10.0.0.236/trunk@8113 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsPresContext.cpp | 14 +++++++------- mozilla/layout/base/src/nsPresContext.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 036082fa8a3..45ae352ed5c 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -80,10 +80,10 @@ nsPresContext::~nsPresContext() NS_RELEASE(loader); } - // XXX Tell the image library we are done with the cached images? - if (nsnull != mImageGroup) { - /*XXX mImageGroup->Interrupt(); required? */ + // Interrupt any loading images. This also stops all looping + // image animations. + mImageGroup->Interrupt(); NS_RELEASE(mImageGroup); } @@ -423,16 +423,16 @@ nsPresContext::StartLoadImage(const nsString& aURL, if (NS_OK != rv) { return rv; } - mImageLoaders.AppendElement(loader); - - // Return new loader - NS_ADDREF(loader); rv = loader->Init(this, mImageGroup, aURL, aBackgroundColor, aTargetFrame, aNeedSizeUpdate); if (NS_OK != rv) { + NS_RELEASE(loader); return rv; } + // Return the loader + mImageLoaders.AppendElement(loader); + NS_ADDREF(loader); aLoaderResult = loader; return NS_OK; } diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index 036082fa8a3..45ae352ed5c 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -80,10 +80,10 @@ nsPresContext::~nsPresContext() NS_RELEASE(loader); } - // XXX Tell the image library we are done with the cached images? - if (nsnull != mImageGroup) { - /*XXX mImageGroup->Interrupt(); required? */ + // Interrupt any loading images. This also stops all looping + // image animations. + mImageGroup->Interrupt(); NS_RELEASE(mImageGroup); } @@ -423,16 +423,16 @@ nsPresContext::StartLoadImage(const nsString& aURL, if (NS_OK != rv) { return rv; } - mImageLoaders.AppendElement(loader); - - // Return new loader - NS_ADDREF(loader); rv = loader->Init(this, mImageGroup, aURL, aBackgroundColor, aTargetFrame, aNeedSizeUpdate); if (NS_OK != rv) { + NS_RELEASE(loader); return rv; } + // Return the loader + mImageLoaders.AppendElement(loader); + NS_ADDREF(loader); aLoaderResult = loader; return NS_OK; }