Bug 615527 - zenity hangs if invalid WINDOWID is specified
This commit is contained in:
parent
70c689bebe
commit
eb6ed94c9e
@ -323,13 +323,14 @@ transient_get_xterm (void)
|
|||||||
const char *wid_str = g_getenv ("WINDOWID");
|
const char *wid_str = g_getenv ("WINDOWID");
|
||||||
if (wid_str) {
|
if (wid_str) {
|
||||||
char *wid_str_end;
|
char *wid_str_end;
|
||||||
|
int ret;
|
||||||
Window wid = strtoul (wid_str, &wid_str_end, 10);
|
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;
|
XWindowAttributes attrs;
|
||||||
gdk_error_trap_push ();
|
gdk_error_trap_push ();
|
||||||
XGetWindowAttributes (GDK_DISPLAY(), wid, &attrs);
|
ret = XGetWindowAttributes (GDK_DISPLAY(), wid, &attrs);
|
||||||
gdk_flush();
|
gdk_flush();
|
||||||
if (gdk_error_trap_pop () != 0) {
|
if (gdk_error_trap_pop () != 0 || ret == 0) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
return wid;
|
return wid;
|
||||||
|
Reference in New Issue
Block a user