diff options
author | Vincent Untz <vuntz@gnome.org> | 2006-05-29 19:55:10 +0000 |
---|---|---|
committer | Vincent Untz <vuntz@src.gnome.org> | 2006-05-29 19:55:10 +0000 |
commit | fc4df0d61762c0299ab8437128e6df7e801b77dc (patch) | |
tree | c17945a1e2a9b260e95649227806eff3093e9c4a | |
parent | f735444d98d25194267308aa556f626a337e9393 (diff) | |
download | libwnck-fc4df0d61762c0299ab8437128e6df7e801b77dc.tar.gz |
Backport from HEAD.
2006-05-29 Vincent Untz <vuntz@gnome.org>
Backport from HEAD.
* libwnck/xutils.c: (_wnck_gdk_pixbuf_get_from_pixmap): don't assume
the drawable will always exist. Fix crash in bug #336823.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libwnck/xutils.c | 37 |
2 files changed, 28 insertions, 16 deletions
@@ -1,3 +1,10 @@ +2006-05-29 Vincent Untz <vuntz@gnome.org> + + Backport from HEAD. + + * libwnck/xutils.c: (_wnck_gdk_pixbuf_get_from_pixmap): don't assume + the drawable will always exist. Fix crash in bug #336823. + 2006-04-18 Kjartan Maraas <kmaraas@gnome.org> * configure.in: Remove obsolete entry for no_NO diff --git a/libwnck/xutils.c b/libwnck/xutils.c index 11463dc..46afb66 100644 --- a/libwnck/xutils.c +++ b/libwnck/xutils.c @@ -1611,6 +1611,7 @@ _wnck_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest, GdkColormap *cmap; retval = NULL; + cmap = NULL; drawable = gdk_xid_table_lookup (xpixmap); @@ -1619,26 +1620,30 @@ _wnck_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest, else drawable = gdk_pixmap_foreign_new (xpixmap); - cmap = get_cmap (drawable); + if (drawable) + { + cmap = get_cmap (drawable); - /* GDK is supposed to do this but doesn't in GTK 2.0.2, - * fixed in 2.0.3 - */ - if (width < 0) - gdk_drawable_get_size (drawable, &width, NULL); - if (height < 0) - gdk_drawable_get_size (drawable, NULL, &height); - - retval = gdk_pixbuf_get_from_drawable (dest, - drawable, - cmap, - src_x, src_y, - dest_x, dest_y, - width, height); + /* GDK is supposed to do this but doesn't in GTK 2.0.2, + * fixed in 2.0.3 + */ + if (width < 0) + gdk_drawable_get_size (drawable, &width, NULL); + if (height < 0) + gdk_drawable_get_size (drawable, NULL, &height); + + retval = gdk_pixbuf_get_from_drawable (dest, + drawable, + cmap, + src_x, src_y, + dest_x, dest_y, + width, height); + } if (cmap) g_object_unref (G_OBJECT (cmap)); - g_object_unref (G_OBJECT (drawable)); + if (drawable) + g_object_unref (G_OBJECT (drawable)); return retval; } |