From 3deecbd85f34cf5a6a843f252bd48802009aa271 Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Mon, 20 May 2002 21:31:27 +0000 Subject: [PATCH] fixes bug 141779 "Trunk, M1RC1 Crashes related to DNS caching [@ nsDNSRequest::FireStop]" r=gordon sr=rpotts git-svn-id: svn://10.0.0.236/trunk@121889 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/dns/src/nsDnsService.cpp | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/mozilla/netwerk/dns/src/nsDnsService.cpp b/mozilla/netwerk/dns/src/nsDnsService.cpp index f10c088fe38..c38c68fca84 100644 --- a/mozilla/netwerk/dns/src/nsDnsService.cpp +++ b/mozilla/netwerk/dns/src/nsDnsService.cpp @@ -449,19 +449,23 @@ NS_IMETHODIMP nsDNSRequest::Cancel(nsresult status) { NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code"); - nsresult rv = NS_OK; - mStatus = status; - - NS_ASSERTION(!PR_CLIST_IS_EMPTY(this), "request is not queue on lookup"); - if (!PR_CLIST_IS_EMPTY(this)) { - nsDNSService::Lock(); - PR_REMOVE_AND_INIT_LINK(this); - nsDNSService::Unlock(); - } - if (mUserListener) rv = FireStop(status); - mLookup = nsnull; - return rv; + PRBool ignore = PR_FALSE; + nsDNSService::Lock(); + if (PR_CLIST_IS_EMPTY(this)) { + // ignore this cancelation since we've already called OnStopLookup or + // are in the process of calling OnStopLookup (on a different thread). + ignore = PR_TRUE; + } else { + PR_REMOVE_AND_INIT_LINK(this); + ignore = (mUserListener == nsnull); + } + nsDNSService::Unlock(); + + if (ignore) + return NS_OK; + + return FireStop(status); } NS_IMETHODIMP