summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Burton <rburton@src.gnome.org>2004-11-23 10:08:50 +0000
committerRoss Burton <rburton@src.gnome.org>2004-11-23 10:08:50 +0000
commit04476d04fed7f5cbca232030121acca61d549116 (patch)
treedaef1f8eb7afb863ddf3636ed0e9df98934ce32f
parent81317a4c82c5667c17d167f19082dfb192dda250 (diff)
Check the xterm window ID is valid before using it
-rw-r--r--ChangeLog5
-rw-r--r--src/util.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 814ee19..68d6e27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/src/util.c b/src/util.c
index 6e9de2a..ff7d18b 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;
}