summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2003-10-23 00:47:47 +0000
committerwchang0222%aol.com <devnull@localhost>2003-10-23 00:47:47 +0000
commit9756d74b1ea78943304ea50e72836d97bd530be8 (patch)
treef806e5a862676bb102db803030a05d97ec1d0259
parent0e2d5a382188c1402dc2ec73798f8d870f79df38 (diff)
downloadnspr-hg-9756d74b1ea78943304ea50e72836d97bd530be8.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. Tag: NSPR_4_4_BRANCH
-rw-r--r--pr/src/md/unix/solaris.c23
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)