From: Nicholas Clark Date: Mon, 4 May 2009 17:12:03 +0000 (+0100) Subject: Fix SEGVs when cloning a typeglob that has been undefined. (RT #64954) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1dffc4d1a24556f4e23f612d6713492847ff064b;p=p5sagit%2Fp5-mst-13.2.git Fix SEGVs when cloning a typeglob that has been undefined. (RT #64954) --- diff --git a/sv.c b/sv.c index 7d2eae5..b13985b 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 814b595..c8ed34a 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