summaryrefslogtreecommitdiff
path: root/gdk/gdkwindow.c
diff options
context:
space:
mode:
authorElliot Lee <sopwith@src.gnome.org>1998-07-16 19:41:12 +0000
committerElliot Lee <sopwith@src.gnome.org>1998-07-16 19:41:12 +0000
commit5e3acecc12dc9b7671ea56150a66e2ae41a65a6e (patch)
tree1c61988ad8601b7ca588afeeb2740a41eaa59727 /gdk/gdkwindow.c
parent8f733319d123f4fb42da17a361f5340137805ccd (diff)
downloadgdk-pixbuf-5e3acecc12dc9b7671ea56150a66e2ae41a65a6e.tar.gz
Make gdk_window_foreign_new fail gracefully
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r--gdk/gdkwindow.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 5b695b270..cb04d61a0 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -465,17 +465,21 @@ gdk_window_foreign_new (guint32 anid)
GdkWindowPrivate *parent_private;
XWindowAttributes attrs;
Window root, parent;
- Window *children;
+ Window *children = NULL;
guint nchildren;
+ if(!XGetWindowAttributes (gdk_display, anid, &attrs)) {
+ g_warning("XGetWindowAttributes failed on window ID %d\n", anid);
+ return NULL;
+ }
+
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
- XGetWindowAttributes (gdk_display, anid, &attrs);
-
/* FIXME: This is pretty expensive. Maybe the caller should supply
* the parent */
XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
+
if (children)
XFree (children);
private->parent = gdk_xid_table_lookup (parent);