This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
in perl_clone_using, free the prt_table
authorDavid Mitchell <davem@iabyn.com>
Wed, 5 Aug 2009 14:23:41 +0000 (15:23 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 5 Aug 2009 14:28:55 +0000 (15:28 +0100)
*after* we have called any CLONE methods
(better fix for Variable::Magic than 240bfeb992)

sv.c

diff --git a/sv.c b/sv.c
index 8bfe441..a22316c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12349,11 +12349,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
 
     PL_registered_mros  = hv_dup_inc(proto_perl->Iregistered_mros, param);
 
-    if (!(flags & CLONEf_KEEP_PTR_TABLE)) {
-        ptr_table_free(PL_ptr_table);
-        PL_ptr_table = NULL;
-    }
-
     /* Call the ->CLONE method, if it exists, for each of the stashes
        identified by sv_dup() above.
     */
@@ -12373,6 +12368,12 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
        }
     }
 
+    if (!(flags & CLONEf_KEEP_PTR_TABLE)) {
+        ptr_table_free(PL_ptr_table);
+        PL_ptr_table = NULL;
+    }
+
+
     SvREFCNT_dec(param->stashes);
 
     /* orphaned? eg threads->new inside BEGIN or use */