diff options
author | Elliot Lee <sopwith@src.gnome.org> | 1998-07-16 19:41:12 +0000 |
---|---|---|
committer | Elliot Lee <sopwith@src.gnome.org> | 1998-07-16 19:41:12 +0000 |
commit | 5e3acecc12dc9b7671ea56150a66e2ae41a65a6e (patch) | |
tree | 1c61988ad8601b7ca588afeeb2740a41eaa59727 /gdk/gdkwindow.c | |
parent | 8f733319d123f4fb42da17a361f5340137805ccd (diff) | |
download | gdk-pixbuf-5e3acecc12dc9b7671ea56150a66e2ae41a65a6e.tar.gz |
Make gdk_window_foreign_new fail gracefully
Diffstat (limited to 'gdk/gdkwindow.c')
-rw-r--r-- | gdk/gdkwindow.c | 10 |
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); |