Bug 414997, PR_NewThreadPrivateIndex contract is violated by PR_CreateThread impls NSPR_HEAD_20080129_MINIBRANCH
authorkaie%kuix.de
Thu, 31 Jan 2008 16:25:26 +0000
branchNSPR_HEAD_20080129_MINIBRANCH
changeset 3925 d105115936cbb7ae9b534beb359000c60b45046e
parent 3924 97ee302126e8262cca444e0adb7b3facfd4eb2ec
child 3926 239d801010495abe70a5ff34d692052f46e23da9
push idunknown
push userunknown
push dateunknown
bugs414997
Bug 414997, PR_NewThreadPrivateIndex contract is violated by PR_CreateThread impls Patch contributed by Wan-Teh Chang r=julien.pierre, r=me Landing on mini branch for ff3b3, intended for this fix only, because trunk is frozen
pr/src/pthreads/ptthread.c
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -252,16 +252,18 @@ static void *_pt_root(void *arg)
     * Otherwise the destructor would get called eagerly as the thread
     * returns to the pthread runtime. The joining thread would them be
     * the proud possessor of a dangling reference. However, this is the
     * last chance to delete the object if the thread is detached, so
     * just let the destructor do the work.
     */
     if (PR_FALSE == detached)
     {
+        /* Call TPD destructors on this thread. */
+        _PR_DestroyThreadPrivate(thred);
         rv = pthread_setspecific(pt_book.key, NULL);
         PR_ASSERT(0 == rv);
     }
 
     return NULL;
 }  /* _pt_root */
 
 static PRThread* pt_AttachThread(void)
@@ -592,17 +594,17 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRT
         rv = pthread_join(id, &result);
         PR_ASSERT(rv == 0 && result == NULL);
         if (0 == rv)
         {
 #ifdef _PR_DCETHREADS
             rv = pthread_detach(&id);
             PR_ASSERT(0 == rv);
 #endif
-            _pt_thread_death(thred);
+            _pt_thread_death_internal(thred, PR_FALSE);
         }
         else
         {
             PRErrorCode prerror;
             switch (rv)
             {
                 case EINVAL:  /* not a joinable thread */
                 case ESRCH:   /* no thread with given ID */