diff options
author | wchang0222%aol.com <devnull@localhost> | 2003-10-23 00:43:36 +0000 |
---|---|---|
committer | wchang0222%aol.com <devnull@localhost> | 2003-10-23 00:43:36 +0000 |
commit | 511db394feebd24dac9de5e8a9ed0bbeb813f754 (patch) | |
tree | 79749e6dbdbf6f04a3736d613e5f857fb6611949 /pr/src/md/unix | |
parent | 4578ed7a65d1a420137bb10e49dbe33396974b85 (diff) | |
download | nspr-hg-511db394feebd24dac9de5e8a9ed0bbeb813f754.tar.gz |
Bugzilla bug 214411: fixed a bug introduced in the previous checkin.
threadid_key_destructor may get called on the primordial thread if the app
doesn't call PR_Cleanup and the assertion would fail. Thanks to
Gerard Roos <gerard.roos@adnovum.ch> for contributing the patch.
Diffstat (limited to 'pr/src/md/unix')
-rw-r--r-- | pr/src/md/unix/solaris.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/pr/src/md/unix/solaris.c b/pr/src/md/unix/solaris.c index 3313ac83..0437903a 100644 --- a/pr/src/md/unix/solaris.c +++ b/pr/src/md/unix/solaris.c @@ -187,16 +187,19 @@ static void threadid_key_destructor(void *value) { PRThread *me = (PRThread *)value; - PR_ASSERT((me != NULL) && (me->flags & _PR_ATTACHED)); - /* - * The Solaris thread library sets the thread specific - * data (the current thread) to NULL before invoking - * the destructor. We need to restore it to prevent the - * _PR_MD_CURRENT_THREAD() call in _PRI_DetachThread() - * from attaching the thread again. - */ - _PR_MD_SET_CURRENT_THREAD(me); - _PRI_DetachThread(); + PR_ASSERT(me != NULL); + /* the thread could be PRIMORDIAL (thus not ATTACHED) */ + if (me->flags & _PR_ATTACHED) { + /* + * The Solaris thread library sets the thread specific + * data (the current thread) to NULL before invoking + * the destructor. We need to restore it to prevent the + * _PR_MD_CURRENT_THREAD() call in _PRI_DetachThread() + * from attaching the thread again. + */ + _PR_MD_SET_CURRENT_THREAD(me); + _PRI_DetachThread(); + } } void _MD_EarlyInit(void) |