Closed Bug 83508 Opened 23 years ago Closed 23 years ago

crash in thread cleanup in nsExceptionService

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jband_mozilla, Assigned: markh)

References

Details

Attachments

(2 files)

Hey Mark. Two bugs for the price of one!

In nsExceptionService::DoDropThread...
http://lxr.mozilla.org/seamonkey/search?string=nsExceptionService%3A%3ADoDrop

(I'll attach this too to make it easy to apply)

Index: nsExceptionService.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/base/nsExceptionService.cpp,v
retrieving revision 1.2
diff -u -r1.2 nsExceptionService.cpp
--- nsExceptionService.cpp      2001/05/08 17:39:22     1.2
+++ nsExceptionService.cpp      2001/05/31 18:15:23
@@ -304,9 +304,9 @@
 /*static*/ void nsExceptionService::DoDropThread(nsExceptionManager *thread)
 {
     if (thread == firstThread) {
-        firstThread = nsnull;
+        firstThread = firstThread->mNextThread;
     } else {
-        nsExceptionManager *look = firstThread->mNextThread;
+        nsExceptionManager *look = firstThread;
         while (look && look->mNextThread != thread) {
             look = look->mNextThread;
         }

1) The first change avoids a later crash. You don't want to orphan the list just 
because you're removing the first item.

2) The other change keeps you from failing to find the thread when it is the 
second item in the list; i.e. thread == firstThread->mNextThread.

I just checked in an old xpcshell multithreaded test that had been kicking 
around (mostly to find threading bugs in the JS Engine). See 
mozilla/js/src/xpconnect/tests/js/old/threads.js

If you like these changes then please take care of getting them into the tree. 
sr=jband, r=you, approval you have to get.
Attached patch proposed fixSplinter Review
Eeek - sorry about that John, and thanks for the patch!

Mail sent to drivers seeking a=
Status: NEW → ASSIGNED
Unify the basis and induction cases!  Patch coming up, also provides an r/sr= if
you like it (jband can't sr= his own patches, drivers will insist).

/be
The patch looks good (and elegant) to me!  Release builds could die in 
pathological cases (ie, if the assert ever fails in debug build, the same 
scenario will crash release), but I assume we are happy with the debug only 
check?  I am :)  

I am a little confused by Brendan's comment on the the sr= - if you are now 
offering the sr=, aren't we in the same position as before - ie, you sr'ing 
your own patch?

Maybe just to save confusion jband can _now_ offer the sr!

Still need an a= tho!
Blocks: 83989
a=blizzard for the trunk
sr=jband
Checked in rev 1.3 of nsExceptionService.cpp.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: