From 5f59fd399efb211e81aeb3c3ce89e07970d87626 Mon Sep 17 00:00:00 2001 From: "markh%activestate.com" Date: Mon, 4 Jun 2001 23:01:26 +0000 Subject: [PATCH] Prevent crash in certain multi-threaded situations. Bug 83508. r=markh, sr=jband, a=blizzard. git-svn-id: svn://10.0.0.236/trunk@96342 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/base/nsExceptionService.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mozilla/xpcom/base/nsExceptionService.cpp b/mozilla/xpcom/base/nsExceptionService.cpp index 8c05e847adb..cbfa7950ff7 100644 --- a/mozilla/xpcom/base/nsExceptionService.cpp +++ b/mozilla/xpcom/base/nsExceptionService.cpp @@ -303,19 +303,15 @@ nsresult nsExceptionService::DoGetExceptionFromProvider( nsresult errCode, nsIEx /*static*/ void nsExceptionService::DoDropThread(nsExceptionManager *thread) { - if (thread == firstThread) { - firstThread = nsnull; - } else { - nsExceptionManager *look = firstThread->mNextThread; - while (look && look->mNextThread != thread) { - look = look->mNextThread; - } - NS_ABORT_IF_FALSE(look, "Could not find the thread to drop!"); - if (look) - look->mNextThread = thread->mNextThread; + nsExceptionManager **emp = &firstThread; + while (*emp != thread) { + NS_ABORT_IF_FALSE(*emp, "Could not find the thread to drop!"); + emp = &(*emp)->mNextThread; } + *emp = thread->mNextThread; NS_RELEASE(thread); } + /*static*/ void nsExceptionService::DropThread(nsExceptionManager *thread) { PR_Lock(lock);