cvsuser 04/11/30 04:22:01
Modified: classes eval.pmc sub.pmc
Log:
fix eval destruction order
Revision Changes Path
1.36 +10 -1 parrot/classes/eval.pmc
Index: eval.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/eval.pmc,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- eval.pmc 27 Nov 2004 14:39:20 -0000 1.35
+++ eval.pmc 30 Nov 2004 12:22:01 -0000 1.36
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: eval.pmc,v 1.35 2004/11/27 14:39:20 leo Exp $
+$Id: eval.pmc,v 1.36 2004/11/30 12:22:01 leo Exp $
=head1 NAME
@@ -28,6 +28,7 @@
struct PackFile_ByteCode *seg;
struct PackFile_FixupTable *ft;
struct PackFile_ConstTable *ct;
+ PMC *sub;
seg = PMC_sub(self)->seg;
if (!seg)
@@ -42,6 +43,8 @@
switch (ft->fixups[i]->type) {
case enum_fixup_sub:
ci = ft->fixups[i]->offset;
+ sub = ct->constants[ci]->u.key;
+ VTABLE_destroy(interpreter, sub);
ct->constants[ci]->u.key = NULL;
ft->fixups[i]->type = 0;
}
@@ -63,6 +66,8 @@
PObj *name;
sub_data = PMC_sub(SELF);
+ if (!sub_data)
+ return;
name = (PObj*)sub_data->name;
if (name)
pobject_lives(INTERP, name);
@@ -87,6 +92,9 @@
clear_fixups(interpreter, SELF);
sub_data = PMC_sub(SELF);
+
+ if (!sub_data)
+ return;
cur_cs = sub_data->seg;
if (!cur_cs)
return;
@@ -104,6 +112,7 @@
seg = (struct PackFile_Segment *)cur_cs;
PackFile_Segment_destroy(seg);
sub_data->seg = NULL;
+ PMC_sub(SELF) = NULL;
}
1.68 +4 -1 parrot/classes/sub.pmc
Index: sub.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/sub.pmc,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- sub.pmc 27 Nov 2004 14:39:20 -0000 1.67
+++ sub.pmc 30 Nov 2004 12:22:01 -0000 1.68
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: sub.pmc,v 1.67 2004/11/27 14:39:20 leo Exp $
+$Id: sub.pmc,v 1.68 2004/11/30 12:22:01 leo Exp $
=head1 NAME
@@ -135,6 +135,8 @@
void destroy () {
struct Parrot_sub * sub = PMC_sub(SELF);
+ if (!sub)
+ return;
#if 0
STRING *n = sub_name(INTERP, SELF);
fprintf(stderr, "DESTROY sub %p %s\n", SELF,
@@ -142,6 +144,7 @@
#endif
clear_fixup(INTERP, SELF);
mem_sys_free(sub);
+ PMC_sub(SELF) = NULL;
}
/*