[goffice] Foramts: fix problem with sticky colours.



commit 5c341423c67dbc41573466244c5f2bef179e30ee
Author: Morten Welinder <terra gnome org>
Date:   Fri Aug 12 11:21:50 2011 -0400

    Foramts: fix problem with sticky colours.

 ChangeLog                 |    6 ++++++
 NEWS                      |    1 +
 goffice/utils/go-format.c |   10 ++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 09a9a68..d3fcb32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-12  Morten Welinder  <terra gnome org>
+
+	* goffice/utils/go-format.c (go_format_value_gstring): Avoid
+	changing attribute list we don't own.  Fixes problem with sticky
+	format colours.
+
 2011-08-09  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-smoothed-curve.c
diff --git a/NEWS b/NEWS
index a04b905..a707aea 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Jean:
 
 Morten:
 	* Recognize scientific formats with longer exponents.
+	* Fix problem with sticky format colouring.
 
 --------------------------------------------------------------------------
 goffice 0.8.17:
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index deee654..2a08f76 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -3612,11 +3612,13 @@ SUFFIX(go_format_value_gstring) (PangoLayout *layout, GString *str,
 		*go_color = fmt->color;
 
 	if (layout && fmt->color != 0) {
-		PangoAttrList *attrs;
+		/*
+		 * We ignore fully-transparent black, no-one should be able to
+		 * specify that as a color anyway.  And it is invisible.
+		 */
+		PangoAttrList *attrs = pango_layout_get_attributes (layout);
 		PangoAttribute *attr;
-		attrs = pango_attr_list_ref (pango_layout_get_attributes (layout));
-		if (attrs == NULL)
-			attrs = pango_attr_list_new ();
+		attrs = attrs ? pango_attr_list_copy (attrs) : pango_attr_list_new ();
 		attr = go_color_to_pango (fmt->color, TRUE);
 		attr->start_index = 0;
 		attr->end_index = G_MAXUINT;



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