diff nodejs/coord.cc @ 742:24038e7a365b

Reorder instructions to invalidate coords correctly
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 25 Aug 2010 11:58:30 +0800
parents d8764f10e141
children dd1f3382d6a4
line wrap: on
line diff
--- a/nodejs/coord.cc	Wed Aug 25 10:40:30 2010 +0800
+++ b/nodejs/coord.cc	Wed Aug 25 11:58:30 2010 +0800
@@ -67,8 +67,8 @@
  */
 static void
 xnjsmb_coord_invalidate_subtree(Handle<Object> self) {
-    Handle<Object> *child_hdl;
-    Handle<Object> *mem_hdl;
+    Persistent<Object> *child_hdl;
+    Persistent<Object> *mem_hdl;
     redraw_man_t *rdman;
     coord_t *coord, *child;
     shape_t *mem;
@@ -81,18 +81,17 @@
     
     /* Invalidate all coords in the subtree */
     FOR_COORDS_PREORDER(coord, child) {
-	child_hdl = (Handle<Object> *)mb_prop_get(&child->obj.props,
-						   PROP_JSOBJ);
-	child = (coord_t *)UNWRAP(*child_hdl);
+	child_hdl = (Persistent<Object> *)mb_prop_get(&child->obj.props,
+						      PROP_JSOBJ);
+	SET(*child_hdl, "valid", _false);
 	WRAP(*child_hdl, NULL);
-	SET(*child_hdl, "valid", _false);
 	
 	/* Invalidate members of a coord */
 	FOR_COORD_SHAPES(child, mem) {
-	    mem_hdl = (Handle<Object> *)mb_prop_get(&mem->obj.props,
-						    PROP_JSOBJ);
+	    mem_hdl = (Persistent<Object> *)mb_prop_get(&mem->obj.props,
+							PROP_JSOBJ);
+	    SET(*mem_hdl, "valid", _false);
 	    WRAP(*mem_hdl, NULL);
-	    SET(*mem_hdl, "valid", _false);
 	}
     }
 }