Check the xterm window ID is valid before using it

This commit is contained in:
Ross Burton 2004-11-23 10:08:50 +00:00
parent 81317a4c82
commit 04476d04fe
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-11-23 Ross Burton <ross@burtonini.com>
* src/util.c: Check the xterm window ID is valid for the current
display before trying to use it.
2004-10-30 Francisco Javier F. Serrador <serrador@cvs.gnome.org>
* src/main.c: Typo fixing: Notication options --> Notification options

View File

@ -272,9 +272,17 @@ 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;
}