Fix a case of segfault in ithread destruction
Rafael Garcia-Suarez [Tue, 31 Oct 2006 14:47:25 +0000 (14:47 +0000)]
p4raw-id: //depot/perl@29174

ext/threads/threads.xs

index 81f9f65..977a47a 100755 (executable)
@@ -174,8 +174,8 @@ S_ithread_destruct(pTHX_ ithread *thread)
 
     /* Remove from circular list of threads */
     MUTEX_LOCK(&MY_POOL.create_destruct_mutex);
-    thread->next->prev = thread->prev;
-    thread->prev->next = thread->next;
+    if (thread->next) thread->next->prev = thread->prev;
+    if (thread->prev) thread->prev->next = thread->next;
     thread->next = NULL;
     thread->prev = NULL;
     MUTEX_UNLOCK(&MY_POOL.create_destruct_mutex);