[svn:parrot] r36408 - trunk/src
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sat Feb 7 01:14:33 UTC 2009
Author: NotFound
Date: Sat Feb 7 01:14:33 2009
New Revision: 36408
URL: https://trac.parrot.org/parrot/changeset/36408
Log:
[core] quick hack to avoid infinite recursion when an exception is thrown while looking for a handler
Modified:
trunk/src/scheduler.c
Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c Sat Feb 7 00:48:37 2009 (r36407)
+++ trunk/src/scheduler.c Sat Feb 7 01:14:33 2009 (r36408)
@@ -834,11 +834,23 @@
Parrot_cx_find_handler_local(PARROT_INTERP, ARGIN(PMC *task))
{
ASSERT_ARGS(Parrot_cx_find_handler_local)
+
+ /*
+ * Quick&dirty way to avoid infinite recursion
+ * when an exception is thown while looking
+ * for a handler
+ */
+ static int already_doing = 0;
+
Parrot_Context *context;
PMC *iter = PMCNULL;
STRING * const handled_str = CONST_STRING(interp, "handled");
STRING * const iter_str = CONST_STRING(interp, "handler_iter");
+ if (already_doing)
+ return NULL;
+ ++already_doing;
+
/* Exceptions store the handler iterator for rethrow, other kinds of
* tasks don't (though they could). */
if (task->vtable->base_type == enum_class_Exception
@@ -868,6 +880,7 @@
VTABLE_set_attr_str(interp, task, CONST_STRING(interp, "handler_iter"), iter);
VTABLE_set_pointer(interp, task, context);
}
+ --already_doing;
return handler;
}
}
@@ -883,6 +896,7 @@
/* Reached the end of the context chain without finding a handler. */
+ --already_doing;
return PMCNULL;
}
More information about the parrot-commits
mailing list