Mercurial > emacs
changeset 43914:fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 14 Mar 2002 09:13:28 +0000 |
parents | edfc0feeb0c3 |
children | 47fa5e2f85ab |
files | src/xfns.c |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xfns.c Thu Mar 14 09:05:00 2002 +0000 +++ b/src/xfns.c Thu Mar 14 09:13:28 2002 +0000 @@ -1176,13 +1176,19 @@ Window wm_window, rootw; Window *tmp_children; unsigned int tmp_nchildren; - - XQueryTree (FRAME_X_DISPLAY (f), win, &rootw, - &wm_window, &tmp_children, &tmp_nchildren); - XFree ((char *) tmp_children); + int success; + + 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;