Author: chromatic
Date: Sat Aug 9 13:35:41 2008
New Revision: 30149
Modified:
trunk/src/pmc/exception.pmc
Log:
[PMC] Fixed context reference counting in Exception PMC, so that exception
contexts don't get destroyed early but do get destroyed on time. This fixes
some double-free errors during Parrot full destruction and probably prevents
other weird memory errors in long running programs.
Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc (original)
+++ trunk/src/pmc/exception.pmc Sat Aug 9 13:35:41 2008
@@ -439,7 +439,12 @@
VTABLE void set_pointer(void *context) {
Parrot_Exception * const core_struct = PARROT_EXCEPTION(SELF);
+
+ /* contexts are refcounted; increment and decrement appropriately */
+ if (core_struct->handler_ctx)
+ Parrot_free_context(interp, core_struct->handler_ctx, 0);
core_struct->handler_ctx = (Parrot_Context *)context;
+ core_struct->handler_ctx->ref_count++;
}
/*