Author: chromatic
Date: Sat Apr 14 14:31:11 2007
New Revision: 18207

Modified:
   trunk/src/pmc/eval.pmc
   trunk/src/pmc/managedstruct.pmc
   trunk/src/pmc/namespace.pmc
   trunk/src/pmc/sharedref.pmc

Log:
[PMC] Call SUPER() in destroy() for all PMCs that call SUPER() in init().

This is important for PMCs that manage their own memory.

Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc      (original)
+++ trunk/src/pmc/eval.pmc      Sat Apr 14 14:31:11 2007
@@ -189,6 +189,7 @@
         sub_data->seg = NULL;
         PMC_struct_val(SELF) = NULL;
         mem_sys_free(sub_data);
+        SUPER();
     }
 
     void mark() {

Modified: trunk/src/pmc/managedstruct.pmc
==============================================================================
--- trunk/src/pmc/managedstruct.pmc     (original)
+++ trunk/src/pmc/managedstruct.pmc     Sat Apr 14 14:31:11 2007
@@ -35,8 +35,8 @@
 */
 
     void init() {
-        SUPER();
         PObj_active_destroy_SET(SELF);
+        PMC_pmc_val(SELF) = NULL;
         PMC_int_val(SELF) = 0;
     }
 
@@ -66,9 +66,8 @@
 */
 
     void destroy() {
-        if (PMC_data(SELF)) {
+        if (PMC_data(SELF))
             mem_sys_free(PMC_data(SELF));
-        }
     }
 
 /*

Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc (original)
+++ trunk/src/pmc/namespace.pmc Sat Apr 14 14:31:11 2007
@@ -109,8 +109,8 @@
 
 */
     void destroy() {
-        SUPER();
         mem_sys_free(PARROT_NSINFO(SELF));
+        SUPER();
     }
 
 /*

Modified: trunk/src/pmc/sharedref.pmc
==============================================================================
--- trunk/src/pmc/sharedref.pmc (original)
+++ trunk/src/pmc/sharedref.pmc Sat Apr 14 14:31:11 2007
@@ -145,6 +145,7 @@
             VTABLE_destroy(INTERP, ref);
         if (PMC_sync(SELF)->owner != INTERP)
             PANIC("SharedRef destroyed by wrong interpreter");
+        SUPER();
     }
 }
 

Reply via email to