summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-01-03 23:45:34 +0000
committerArtur Bergman <sky@nanisky.com>2003-01-03 23:45:34 +0000
commit0405e91e9230dfa76b6164c6ed64f7dab29ff49a (patch)
treeb81b2fb7785540a5be80dcbb66b177c6cef3ebbb /sv.c
parent1d784c9012710943ee8845da67010090b81b0eda (diff)
downloadperl-0405e91e9230dfa76b6164c6ed64f7dab29ff49a.tar.gz
Fixes bug #15273, the return of the object caused
the stash of the object to be cloned, cloning the entire syntax tree and all lexicals in there creating danglning copies to the object. (Pararell but unlinked STASH tree). This adds a new flag, when set it will use STASHES from the thread we are joining into avoiding the problem. p4raw-id: //depot/perl@18419
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index e522a47e38..08eac582e8 100644
--- a/sv.c
+++ b/sv.c
@@ -9346,6 +9346,18 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param)
if (dstr)
return dstr;
+ if(param->flags & CLONEf_JOIN_IN) {
+ /** We are joining here so we don't want do clone
+ something that is bad **/
+
+ if(SvTYPE(sstr) == SVt_PVHV &&
+ HvNAME(sstr)) {
+ /** don't clone stashes if they already exist **/
+ HV* old_stash = gv_stashpv(HvNAME(sstr),0);
+ return (SV*) old_stash;
+ }
+ }
+
/* create anew and remember what it is */
new_SV(dstr);
ptr_table_store(PL_ptr_table, sstr, dstr);