diff object.c @ 15:baa4cb961330

JS objects in python-land are now rooted while in python-land so that they're not gc'd while in python-land.
author Atul Varma <varmaa@toolness.com>
date Sun, 28 Jun 2009 18:39:43 -0700
parents ca17531e8c81
children f3223debd70b
line wrap: on
line diff
--- a/object.c	Sun Jun 28 18:28:35 2009 -0700
+++ b/object.c	Sun Jun 28 18:39:43 2009 -0700
@@ -13,8 +13,13 @@
   // JS_RemoveRoot() always returns JS_TRUE, so don't
   // bother checking its return value.
 
-  // Umm, we need a context... Crap.
-  //JS_RemoveRoot(
+  if (self->obj) {
+    JS_RemoveRootRT(self->runtime->rt, &self->obj);
+    self->obj = NULL;
+  }
+
+  Py_DECREF(self->runtime);
+  self->runtime = NULL;
 }
 
 PyTypeObject PYM_JSObjectType = {