diff --git a/c/xlib/window.c b/c/xlib/window.c index 88786c8..e13efc4 100644 --- a/c/xlib/window.c +++ b/c/xlib/window.c @@ -131,9 +131,10 @@ s48_value scx_Get_Window_Attributes(s48_value Xdisplay, s48_value Xwindow) { //S48_VECTOR_SET(res, 22, s48_enter_fixnum((long)WA.screen)); // WA.screen not yet supported res = s48_cons(s48_enter_integer((1L<<23) - 1), res); + + S48_GC_UNPROTECT(); } - S48_GC_UNPROTECT(); return res; } @@ -150,7 +151,7 @@ s48_value Changes_To_XWindowChanges(s48_value changes, XWindowChanges* WC) { if (mask & CWHeight) WC->height = s48_extract_integer(S48_VECTOR_REF(v, 3)); if (mask & CWBorderWidth) - WC->height = s48_extract_integer(S48_VECTOR_REF(v, 4)); + WC->border_width = s48_extract_integer(S48_VECTOR_REF(v, 4)); if (mask & CWSibling) WC->sibling = SCX_EXTRACT_WINDOW(S48_VECTOR_REF(v, 5)); if (mask & CWStackMode) @@ -211,8 +212,10 @@ s48_value scx_Query_Tree (s48_value Xwindow, s48_value Xdisplay) { s48_value v = S48_FALSE, ret = S48_FALSE; S48_DECLARE_GC_PROTECT(2); - XQueryTree (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_WINDOW(Xwindow), - &root, &parent, &children, &n); + if (! XQueryTree (SCX_EXTRACT_DISPLAY(Xdisplay), + SCX_EXTRACT_WINDOW(Xwindow), + &root, &parent, &children, &n)) + return S48_FALSE; ret = s48_make_vector(3, S48_FALSE); v = S48_FALSE; @@ -224,11 +227,13 @@ s48_value scx_Query_Tree (s48_value Xwindow, s48_value Xdisplay) { for (i = 0; i < n; i++) { S48_VECTOR_SET(v, i, SCX_ENTER_WINDOW(children[i])); } + if (children != NULL) XFree(children); S48_VECTOR_SET(ret, 0, SCX_ENTER_WINDOW(root)); S48_VECTOR_SET(ret, 1, SCX_ENTER_WINDOW(parent)); S48_VECTOR_SET(ret, 2, v); + S48_GC_UNPROTECT(); return ret; }