From 04476d04fed7f5cbca232030121acca61d549116 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 23 Nov 2004 10:08:50 +0000 Subject: Check the xterm window ID is valid before using it --- src/util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util.c b/src/util.c index 6e9de2a7..ff7d18b3 100644 --- a/src/util.c +++ b/src/util.c @@ -272,8 +272,16 @@ transient_get_xterm (void) if (wid_str) { char *wid_str_end; Window wid = strtoul (wid_str, &wid_str_end, 10); - if (*wid_str != '\0' && *wid_str_end == '\0' && wid != 0) + if (*wid_str != '\0' && *wid_str_end == '\0' && wid != 0) { + XWindowAttributes attrs; + gdk_error_trap_push (); + XGetWindowAttributes (GDK_DISPLAY(), wid, &attrs); + gdk_flush(); + if (gdk_error_trap_pop () != 0) { + return None; + } return wid; + } } return None; } -- cgit