[goffice] Fixed GOStyle leaks. [#615491]



commit c34bd034b9d18216c5eb60f0b279bfe0caed2aaa
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Apr 12 09:33:09 2010 +0200

    Fixed GOStyle leaks. [#615491]

 ChangeLog                         |    7 +++++++
 NEWS                              |    1 +
 goffice/canvas/goc-styled-item.c  |    7 +++++--
 goffice/graph/gog-styled-object.c |    7 +++++--
 4 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 29a5bb2..1e3b708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-12  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/canvas/goc-styled-item.c (goc_styled_item_set_property): unref
+	the style after setting it. [#615491]
+	* goffice/graph/gog-styled-object.c
+	(gog_styled_object_set_property): ditto.
+
 2010-04-10  Valek Filippov  <frob gnome org>
 
 	* goffice/tests/mf-demo.c: move objects to drawing context,
diff --git a/NEWS b/NEWS
index c85e217..e787d65 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.8.2:
 
 Jean:
 	* Support fd:// URIs on win32. [#608422]
+	* Fixed a style leak. [#615491]
 
 Morten:
 	* Implement conf notification in keyfile case.  [#613523]
diff --git a/goffice/canvas/goc-styled-item.c b/goffice/canvas/goc-styled-item.c
index 9b155ae..7617c0d 100644
--- a/goffice/canvas/goc-styled-item.c
+++ b/goffice/canvas/goc-styled-item.c
@@ -64,10 +64,13 @@ goc_styled_item_set_property (GObject *obj, guint param_id,
 
 	switch (param_id) {
 
-	case STYLED_ITEM_PROP_STYLE :
+	case STYLED_ITEM_PROP_STYLE : {
+		GOStyle *style = GO_STYLE (g_value_get_object (value));
 		resize = go_styled_object_set_style (GO_STYLED_OBJECT (gsi),
-	      			g_value_get_object (value));
+	      			style);
+		g_object_unref (style);
 		break;
+	}
 
 	case STYLED_ITEM_PROP_SCALE_LINE_WIDTH :
 		gsi->scale_line_width =  g_value_get_boolean (value);
diff --git a/goffice/graph/gog-styled-object.c b/goffice/graph/gog-styled-object.c
index ed72c45..5d07ce5 100644
--- a/goffice/graph/gog-styled-object.c
+++ b/goffice/graph/gog-styled-object.c
@@ -89,10 +89,13 @@ gog_styled_object_set_property (GObject *obj, guint param_id,
 
 	switch (param_id) {
 
-	case STYLED_OBJECT_PROP_STYLE :
+	case STYLED_OBJECT_PROP_STYLE : {
+		GOStyle *style = GO_STYLE (g_value_get_object (value));
 		resize = go_styled_object_set_style (GO_STYLED_OBJECT (gso),
-	      			g_value_get_object (value));
+	      			style);
+		g_object_unref (style);
 		break;
+	}
 
 	default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
 		 return; /* NOTE : RETURN */



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