diff nodejs/coord.cc @ 563:bc207070e3d5 Android_Skia

Fix issue of im-properly using persistent handler for coord object template.
author Thinker K.F. Li <thinker@branda.to>
date Mon, 07 Jun 2010 17:24:46 +0800
parents 1b6402f07cd4
children 6639d386db78
line wrap: on
line diff
--- a/nodejs/coord.cc	Mon Jun 07 14:45:01 2010 +0800
+++ b/nodejs/coord.cc	Mon Jun 07 17:24:46 2010 +0800
@@ -65,12 +65,14 @@
 
 static void
 xnjsmb_init_temp(void) {
-    coord_obj_temp = Persistent<ObjectTemplate>(ObjectTemplate::New());
+    coord_obj_temp = Persistent<ObjectTemplate>::New(ObjectTemplate::New());
     coord_obj_temp->SetIndexedPropertyHandler(xnjsmb_coord_get_index,
 					      xnjsmb_coord_set_index);
     coord_obj_temp->SetInternalFieldCount(1);
 }
 
+/*! \brief Create and initialize a Javascript object for a coord.
+ */
 static Handle<Object>
 xnjsmb_coord_new_jsobj(coord_t *coord, Handle<Object> parent_obj,
 		       Handle<Object> js_rt) {
@@ -123,6 +125,8 @@
     coord = rdman_coord_new(rdman, parent);
     ASSERT(coord != NULL);
     coord_obj = xnjsmb_coord_new_jsobj(coord, parent_obj, js_rt);
+
+    scope.Close(coord_obj);
     
     return coord_obj;
 }