]> git.eshelyaron.com Git - emacs.git/commitdiff
(x_real_positions): Handle failure in XQueryTree.
authorRichard M. Stallman <rms@gnu.org>
Thu, 14 Mar 2002 09:13:28 +0000 (09:13 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 14 Mar 2002 09:13:28 +0000 (09:13 +0000)
src/xfns.c

index 8b7304025d7cbdc07db4e9008e0e0dd559a0182d..23d85d10e240a361893f8838e45a964e93a2420d 100644 (file)
@@ -1176,13 +1176,19 @@ x_real_positions (f, xptr, yptr)
       Window wm_window, rootw;
       Window *tmp_children;
       unsigned int tmp_nchildren;
+      int success;
 
-      XQueryTree (FRAME_X_DISPLAY (f), win, &rootw,
-                  &wm_window, &tmp_children, &tmp_nchildren);
-      XFree ((char *) tmp_children);
+      success = XQueryTree (FRAME_X_DISPLAY (f), win, &rootw,
+                           &wm_window, &tmp_children, &tmp_nchildren);
 
       had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
 
+      /* Don't free tmp_children if XQueryTree failed.  */
+      if (! success)
+       break;
+
+      XFree ((char *) tmp_children);
+
       if (wm_window == rootw || had_errors)
         break;