[zenity/gnome-2-30] Bug 615527 - zenity hangs if invalid WINDOWID is specified



commit d7e3379a5026b5d17680116a8b973a1b30259234
Author: Michal Pryc <michal pryc sun com>
Date:   Mon Apr 19 13:36:52 2010 +0100

    Bug 615527 - zenity hangs if invalid WINDOWID is specified

 src/util.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/util.c b/src/util.c
index 036e2b5..ed3c2d4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -323,13 +323,14 @@ transient_get_xterm (void)
   const char *wid_str = g_getenv ("WINDOWID");
   if (wid_str) {
     char *wid_str_end;
+    int ret;
     Window wid = strtoul (wid_str, &wid_str_end, 10);
     if (*wid_str != '\0' && *wid_str_end == '\0' && wid != 0) {
       XWindowAttributes attrs;
       gdk_error_trap_push ();
-      XGetWindowAttributes (GDK_DISPLAY(), wid, &attrs);
+      ret = XGetWindowAttributes (GDK_DISPLAY(), wid, &attrs);
       gdk_flush();
-      if (gdk_error_trap_pop () != 0) {
+      if (gdk_error_trap_pop () != 0 || ret == 0) {
         return None;
       }
       return wid;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]