From 08ae8b6696083f5c4747ec296cbd1c4bdd8fd63c Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Fri, 13 Apr 2001 05:37:29 +0000 Subject: [PATCH] fixing build bustage --- modules/libpr0n/src/imgRequest.cpp | 26 +++++++++++++++---------- modules/libpr0n/src/imgRequestProxy.cpp | 4 ++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp index 96c9bc3081c..8cdf0dadfb9 100644 --- a/modules/libpr0n/src/imgRequest.cpp +++ b/modules/libpr0n/src/imgRequest.cpp @@ -166,6 +166,22 @@ nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus) mObservers.RemoveElement(NS_STATIC_CAST(void*, proxy)); + /* Check mState below before we potentially call Cancel() below. Since + Cancel() may result in OnStopRequest being called back before Cancel() + returns, leaving mState in a different state then the one it was in at + this point. + */ + + // make sure that observer gets an OnStopDecode message sent to it + if (!(mState & onStopDecode)) { + proxy->OnStopDecode(nsnull, nsnull, NS_IMAGELIB_ERROR_FAILURE, nsnull); + } + + // make sure that observer gets an OnStopRequest message sent to it + if (!(mState & onStopRequest)) { + proxy->OnStopRequest(nsnull, nsnull, NS_BINDING_ABORTED); + } + if (mObservers.Count() == 0) { if (mImage) { PR_LOG(gImgLog, PR_LOG_DEBUG, @@ -192,16 +208,6 @@ nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus) #endif } - if (!(mState & onStopDecode)) { - // make sure that observer gets an OnStopDecode message sent to it - proxy->OnStopDecode(nsnull, nsnull, NS_IMAGELIB_ERROR_FAILURE, nsnull); - } - - if (!(mState & onStopRequest)) { - // make sure that observer gets an OnStopRequest message sent to it - proxy->OnStopRequest(nsnull, nsnull, NS_BINDING_ABORTED); - } - return NS_OK; } diff --git a/modules/libpr0n/src/imgRequestProxy.cpp b/modules/libpr0n/src/imgRequestProxy.cpp index e00fc3a8c8f..e27ca6948b4 100644 --- a/modules/libpr0n/src/imgRequestProxy.cpp +++ b/modules/libpr0n/src/imgRequestProxy.cpp @@ -139,13 +139,13 @@ NS_IMETHODIMP imgRequestProxy::Cancel(nsresult status) mCanceled = PR_TRUE; - nsresult rv = NS_REINTERPRET_CAST(imgRequest*, mOwner.get())->RemoveProxy(this, status); + NS_REINTERPRET_CAST(imgRequest*, mOwner.get())->RemoveProxy(this, status); mOwner = nsnull; mListener = nsnull; - return rv; + return NS_OK; } /* void suspend (); */