summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl.c3
-rw-r--r--sv.c2
-rw-r--r--t/op/threads.t10
3 files changed, 12 insertions, 3 deletions
diff --git a/perl.c b/perl.c
index 8aa6a3f9f8..4c80edbb1c 100644
--- a/perl.c
+++ b/perl.c
@@ -949,7 +949,6 @@ perl_destruct(pTHXx)
PL_initav = NULL;
/* shortcuts just get cleared */
- PL_incgv = NULL;
PL_hintgv = NULL;
PL_errgv = NULL;
PL_argvoutgv = NULL;
@@ -964,12 +963,14 @@ perl_destruct(pTHXx)
PL_debstash = NULL;
SvREFCNT_dec(PL_envgv);
+ SvREFCNT_dec(PL_incgv);
SvREFCNT_dec(PL_argvgv);
SvREFCNT_dec(PL_replgv);
SvREFCNT_dec(PL_DBgv);
SvREFCNT_dec(PL_DBline);
SvREFCNT_dec(PL_DBsub);
PL_envgv = NULL;
+ PL_incgv = NULL;
PL_argvgv = NULL;
PL_replgv = NULL;
PL_DBgv = NULL;
diff --git a/sv.c b/sv.c
index 2ced7e3bae..8ef01c9a9b 100644
--- a/sv.c
+++ b/sv.c
@@ -13566,7 +13566,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
#endif
PL_envgv = gv_dup_inc(proto_perl->Ienvgv, param);
- PL_incgv = gv_dup(proto_perl->Iincgv, param);
+ PL_incgv = gv_dup_inc(proto_perl->Iincgv, param);
PL_hintgv = gv_dup_inc(proto_perl->Ihintgv, param);
PL_origfilename = SAVEPV(proto_perl->Iorigfilename);
PL_diehook = sv_dup_inc(proto_perl->Idiehook, param);
diff --git a/t/op/threads.t b/t/op/threads.t
index 2a52efc5cd..61889a9e2d 100644
--- a/t/op/threads.t
+++ b/t/op/threads.t
@@ -9,7 +9,7 @@ BEGIN {
skip_all_without_config('useithreads');
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
- plan(26);
+ plan(27);
}
use strict;
@@ -391,4 +391,12 @@ EOF
is $::hypogamma, 3, 'globs cloned and joined are not recloned';
}
+fresh_perl_is(
+ 'use threads;' .
+ 'async { delete $::{INC}; eval q"my $foo : bar" } ->join; print "ok\n";',
+ "ok",
+ {},
+ 'no crash when deleting $::{INC} in thread'
+);
+
# EOF