[svn:parrot] r39475 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Jun 9 19:59:38 UTC 2009
Author: chromatic
Date: Tue Jun 9 19:59:37 2009
New Revision: 39475
URL: https://trac.parrot.org/parrot/changeset/39475
Log:
[PMC] Fixed Undef morph to Object code in the Undef PMC to avoid odd mark()
errors and concomitant segfaults as well as memory leaks. I won't pretend this
is ideal, but it's an improvement.
Modified:
trunk/src/pmc/undef.pmc
Modified: trunk/src/pmc/undef.pmc
==============================================================================
--- trunk/src/pmc/undef.pmc Tue Jun 9 19:58:39 2009 (r39474)
+++ trunk/src/pmc/undef.pmc Tue Jun 9 19:59:37 2009 (r39475)
@@ -46,8 +46,19 @@
}
else {
PMC * const class_ = PARROT_OBJECT(other)->_class;
+ PMC *clone = VTABLE_clone(interp, other);
+ void *attrs;
pmc_reuse_by_class(INTERP, SELF, class_, PObj_is_object_FLAG);
- Parrot_oo_clone_object(interp, other, class_, SELF);
+
+ /* now swap memory without leaking it */
+ attrs - PMC_data(SELF);
+ PMC_data(SELF) = PMC_data(clone);
+ PMC_data(clone) = attrs;
+ VTABLE_destroy(interp, clone);
+
+ PObj_is_object_SET(SELF);
+ PObj_active_destroy_SET(SELF);
+
}
}
More information about the parrot-commits
mailing list