[libgsf] Document props: initialize ref_count.



commit 75dd5fa6c9f34eae48985b6ceb91c9f927e4b1d1
Author: Morten Welinder <terra gnome org>
Date:   Sat Oct 27 08:47:32 2012 -0400

    Document props: initialize ref_count.
    
    How on Earth did this ever work?

 ChangeLog               |    5 +++++
 NEWS                    |    3 +++
 gsf/gsf-doc-meta-data.c |    4 +++-
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1375141..b41f86a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-27  Morten Welinder  <terra gnome org>
+
+	* gsf/gsf-doc-meta-data.c (gsf_doc_meta_data_insert): Initialize
+	->ref_count.
+
 2012-10-16  Morten Welinder  <terra gnome org>
 
 	* tools/gsf.c (main): Add commands to create zip and ole files.
diff --git a/NEWS b/NEWS
index 4a1d5ae..11073ad 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ libgsf 1.14.25
 jorilx gmail com:
 	* Enhance gsf tool to create archives.
 
+Morten:
+	* Fix memory management problem with document properties.
+
 --------------------------------------------------------------------------
 libgsf 1.14.24
 
diff --git a/gsf/gsf-doc-meta-data.c b/gsf/gsf-doc-meta-data.c
index 0ab518c..b117119 100644
--- a/gsf/gsf-doc-meta-data.c
+++ b/gsf/gsf-doc-meta-data.c
@@ -118,6 +118,7 @@ gsf_doc_meta_data_insert (GsfDocMetaData *meta, char *name, GValue *value)
 	prop->name = name;
 	prop->val  = value;
 	prop->linked_to = NULL;
+	prop->ref_count = 1;
 	g_hash_table_replace (meta->table, prop->name, prop);
 }
 
@@ -309,7 +310,8 @@ gsf_doc_prop_free (GsfDocProp *prop)
 }
 
 static GsfDocProp *
-gsf_doc_prop_ref (GsfDocProp *prop) {
+gsf_doc_prop_ref (GsfDocProp *prop)
+{
 	prop->ref_count++;
 	return prop;
 }



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