summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sv.c2
-rw-r--r--t/op/threads.t7
2 files changed, 7 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index 7d2eae5950..b13985b271 100644
--- a/sv.c
+++ b/sv.c
@@ -10505,7 +10505,7 @@ Perl_gp_dup(pTHX_ GP *const gp, CLONE_PARAMS *const param)
ret->gp_cv = cv_dup_inc(gp->gp_cv, param);
ret->gp_cvgen = gp->gp_cvgen;
ret->gp_line = gp->gp_line;
- ret->gp_file_hek = hek_dup(gp->gp_file_hek, param);
+ ret->gp_file_hek = gp->gp_file_hek ? hek_dup(gp->gp_file_hek, param) : NULL;
return ret;
}
diff --git a/t/op/threads.t b/t/op/threads.t
index 814b59550f..c8ed34a7a1 100644
--- a/t/op/threads.t
+++ b/t/op/threads.t
@@ -16,7 +16,7 @@ BEGIN {
exit 0;
}
- plan(13);
+ plan(14);
}
use strict;
@@ -185,5 +185,10 @@ threads->new(\&safe_re)->join();
# tests in threads don't get counted, so
curr_test(curr_test() + 1);
+# This used to crash in 5.10.0 [perl #64954]
+
+undef *a;
+threads->new(sub {})->join;
+pass("undefing a typeglob doesn't cause a crash during cloning");
# EOF