Mercurial > MadButterfly
changeset 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 | 0cd1511272d2 |
files | nodejs/coord.cc nodejs/testcase.js |
diffstat | 2 files changed, 11 insertions(+), 2 deletions(-) [+] |
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; }
--- a/nodejs/testcase.js Mon Jun 07 14:45:01 2010 +0800 +++ b/nodejs/testcase.js Mon Jun 07 17:24:46 2010 +0800 @@ -4,6 +4,11 @@ sys.puts(r); var mb_rt = new mbfly.mb_rt(":0.0", 300, 200); -sys.puts(mb_rt.root); +var root = mb_rt.root; +sys.puts("root matrix: " + + [root[0], root[1], root[2], root[3], root[4], root[5]]); +var coord = mb_rt.coord_new(root); +sys.puts("coord matrix: " + + [coord[0], coord[1], coord[2], coord[3], coord[4], coord[5]]); setTimeout(function() { sys.puts("timeout"); }, 1000);