[gnumeric] Printing: fix crash for printing images with certain cairo versions.



commit 67b055a781b2c558817f076eed6832d718c73296
Author: Morten Welinder <terra gnome org>
Date:   Mon Oct 18 10:35:54 2010 -0400

    Printing: fix crash for printing images with certain cairo versions.

 ChangeLog                |    5 +++++
 NEWS                     |    1 +
 src/sheet-object-image.c |    6 ++++++
 3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 07a1d05..1dd6ca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-18  Morten Welinder  <terra gnome org>
+
+	* src/sheet-object-image.c (gnm_soi_draw_cairo): Fix printing
+	crash.  [#632439]
+
 2010-10-15  Morten Welinder  <terra gnome org>
 
 	* src/sheet-object-widget.c (sheet_widget_frame_user_config): Use
diff --git a/NEWS b/NEWS
index e2a6119..7657123 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@ Jean:
 Morten:
 	* Fix crash related to broken xls.  [#632050]
 	* Fix print area problem from broken xls.
+	* Fix printing crash.  [#632439]
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.11
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index c9edc40..5797bd5 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -550,6 +550,7 @@ gnm_soi_draw_cairo (SheetObject const *so, cairo_t *cr,
 	pixbuf = soi_get_pixbuf (SHEET_OBJECT_IMAGE (so), 1.);
 	if (!pixbuf || width == 0. || height == 0.)
 		return;
+	cairo_save (cr);
 	img = go_image_new_from_pixbuf (pixbuf);
 	cr_pattern = go_image_create_cairo_pattern (img);
 
@@ -562,6 +563,11 @@ gnm_soi_draw_cairo (SheetObject const *so, cairo_t *cr,
 	cairo_rectangle (cr, 0., 0., width, height);
 	cairo_set_source (cr, cr_pattern);
 	cairo_fill (cr);
+	/*
+	 * We need to unset the source before we destroy the pattern.
+	 * cairo_restore will do that.  See #632439.
+	 */
+	cairo_restore (cr);
 	cairo_pattern_destroy (cr_pattern);
 	g_object_unref (img);
 	g_object_unref (pixbuf);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]