comparison nodejs/coord.cc @ 748:56a5e08cd8af

Make shapes can be removed from the tree
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 25 Aug 2010 18:46:47 +0800
parents 1dbc74a14199
children ed59e659a202
comparison
equal deleted inserted replaced
747:d2f2ed27b84d 748:56a5e08cd8af
194 194
195 static void 195 static void
196 xnjsmb_coord_add_shape(coord_t *coord, Handle<Object> self, 196 xnjsmb_coord_add_shape(coord_t *coord, Handle<Object> self,
197 shape_t *shape, const char **err) { 197 shape_t *shape, const char **err) {
198 Handle<Object> js_rt; 198 Handle<Object> js_rt;
199 Persistent<Object> *shape_hdl;
199 redraw_man_t *rdman; 200 redraw_man_t *rdman;
200 int r; 201 int r;
201 202
202 js_rt = GET(self, "mbrt")->ToObject(); 203 js_rt = GET(self, "mbrt")->ToObject();
203 rdman = xnjsmb_rt_rdman(js_rt); 204 rdman = xnjsmb_rt_rdman(js_rt);
204 r = rdman_add_shape(rdman, shape, coord); 205 r = rdman_add_shape(rdman, shape, coord);
205 if(r != 0) 206 if(r != 0)
206 *err = "Unknown error"; 207 *err = "Unknown error";
208
209 /* see \ref jsgc */
210 shape_hdl = (Persistent<Object> *)mb_prop_get(&shape->obj.props,
211 PROP_JSOBJ);
212 shape_hdl->ClearWeak();
207 } 213 }
208 214
209 static void 215 static void
210 xnjsmb_coord_remove(coord_t *coord, Handle<Object> self) { 216 xnjsmb_coord_remove(coord_t *coord, Handle<Object> self) {
211 Handle<Object> js_rt; 217 Handle<Object> js_rt;