summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-08 14:00:43 +0100
committerNicholas Clark <nick@ccl4.org>2010-10-08 16:58:10 +0100
commit0e7bfc0a13342232c7329dcc019fa6e7fe360521 (patch)
treeaadf0bd025958fe3fa376ed3878df779cc400feb
parent5de8bffdbc0d73b6750568e36033f7168cd88f51 (diff)
downloadperl-0e7bfc0a13342232c7329dcc019fa6e7fe360521.tar.gz
threads::shared should not FREETMPS in its BOOT code.
perl_construct() sets the current interpreter context, and ends in an ENTER. Hence threads::shared needs to restore the interpreter context, and balance the ENTER with a leave. Previously it was using its PERL_SET_CONTEXT() macro, which also contains a FREETMPS. However, this FREETMPS is erroneous in this specific context, as it does not have a balancing SAVETMPS. Hence calling SAVETMPS here would run it in the context of the shared interpreter, but it would (attempt to) free up temporaries created in the context of the parent interpreter.
-rw-r--r--dist/threads-shared/lib/threads/shared.pm2
-rw-r--r--dist/threads-shared/shared.xs3
2 files changed, 3 insertions, 2 deletions
diff --git a/dist/threads-shared/lib/threads/shared.pm b/dist/threads-shared/lib/threads/shared.pm
index 3ff48fd391..269e35a2a2 100644
--- a/dist/threads-shared/lib/threads/shared.pm
+++ b/dist/threads-shared/lib/threads/shared.pm
@@ -7,7 +7,7 @@ use warnings;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.33_03';
+our $VERSION = '1.33_04';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs
index 549fe374b8..6ead3bae43 100644
--- a/dist/threads-shared/shared.xs
+++ b/dist/threads-shared/shared.xs
@@ -1194,7 +1194,8 @@ Perl_sharedsv_init(pTHX)
/* This pair leaves us in shared context ... */
PL_sharedsv_space = perl_alloc();
perl_construct(PL_sharedsv_space);
- CALLER_CONTEXT;
+ LEAVE; /* This balances the ENTER at the end of perl_construct. */
+ PERL_SET_CONTEXT((aTHX = caller_perl));
recursive_lock_init(aTHX_ &PL_sharedsv_lock);
PL_lockhook = &Perl_sharedsv_locksv;
PL_sharehook = &Perl_sharedsv_share;