From: Jan Dubois Date: Thu, 22 Jan 2004 19:18:46 +0000 (-0800) Subject: Re: threads::shared::queue; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=669f4df4d3e46923586e2981355e606fc8a3ab09;p=p5sagit%2Fp5-mst-13.2.git Re: threads::shared::queue; Message-Id: Avoid threads+win32 crash by freeing Perl interpreter slightly later p4raw-id: //depot/perl@22201 --- diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index 48530fe..9d4b2bb 100755 --- a/ext/threads/threads.xs +++ b/ext/threads/threads.xs @@ -93,6 +93,7 @@ ithread* Perl_ithread_get (pTHX) { void Perl_ithread_destruct (pTHX_ ithread* thread, const char *why) { + PerlInterpreter *freeperl = NULL; MUTEX_LOCK(&thread->mutex); if (!thread->next) { Perl_croak(aTHX_ "panic: destruct destroyed thread %p (%s)",thread, why); @@ -144,12 +145,14 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why) thread->params = Nullsv; perl_destruct(thread->interp); - perl_free(thread->interp); + freeperl = thread->interp; thread->interp = NULL; } MUTEX_UNLOCK(&thread->mutex); MUTEX_DESTROY(&thread->mutex); PerlMemShared_free(thread); + if (freeperl) + perl_free(freeperl); PERL_SET_CONTEXT(aTHX); }