summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2006-05-29 19:55:10 +0000
committerVincent Untz <vuntz@src.gnome.org>2006-05-29 19:55:10 +0000
commitfc4df0d61762c0299ab8437128e6df7e801b77dc (patch)
treec17945a1e2a9b260e95649227806eff3093e9c4a
parentf735444d98d25194267308aa556f626a337e9393 (diff)
downloadlibwnck-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--ChangeLog7
-rw-r--r--libwnck/xutils.c37
2 files changed, 28 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 93ad137..9085b3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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;
}