comparison 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
comparison
equal deleted inserted replaced
562:1b6402f07cd4 563:bc207070e3d5
63 63
64 static Persistent<ObjectTemplate> coord_obj_temp; 64 static Persistent<ObjectTemplate> coord_obj_temp;
65 65
66 static void 66 static void
67 xnjsmb_init_temp(void) { 67 xnjsmb_init_temp(void) {
68 coord_obj_temp = Persistent<ObjectTemplate>(ObjectTemplate::New()); 68 coord_obj_temp = Persistent<ObjectTemplate>::New(ObjectTemplate::New());
69 coord_obj_temp->SetIndexedPropertyHandler(xnjsmb_coord_get_index, 69 coord_obj_temp->SetIndexedPropertyHandler(xnjsmb_coord_get_index,
70 xnjsmb_coord_set_index); 70 xnjsmb_coord_set_index);
71 coord_obj_temp->SetInternalFieldCount(1); 71 coord_obj_temp->SetInternalFieldCount(1);
72 } 72 }
73 73
74 /*! \brief Create and initialize a Javascript object for a coord.
75 */
74 static Handle<Object> 76 static Handle<Object>
75 xnjsmb_coord_new_jsobj(coord_t *coord, Handle<Object> parent_obj, 77 xnjsmb_coord_new_jsobj(coord_t *coord, Handle<Object> parent_obj,
76 Handle<Object> js_rt) { 78 Handle<Object> js_rt) {
77 Handle<Object> coord_obj; 79 Handle<Object> coord_obj;
78 static int init_temp = 0; 80 static int init_temp = 0;
121 } 123 }
122 124
123 coord = rdman_coord_new(rdman, parent); 125 coord = rdman_coord_new(rdman, parent);
124 ASSERT(coord != NULL); 126 ASSERT(coord != NULL);
125 coord_obj = xnjsmb_coord_new_jsobj(coord, parent_obj, js_rt); 127 coord_obj = xnjsmb_coord_new_jsobj(coord, parent_obj, js_rt);
128
129 scope.Close(coord_obj);
126 130
127 return coord_obj; 131 return coord_obj;
128 } 132 }
129 133
130 /*! \brief Initialize Javascript object for root coord of a runtime. 134 /*! \brief Initialize Javascript object for root coord of a runtime.