[gnome-online-accounts/wip/rishi/templates: 2/10] daemon: Let KeyFileData own a reference to the GKeyFile



commit 89c055d8e08f2ba013a515390c0b0c67c3daa0e1
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Aug 26 15:30:03 2016 +0200

    daemon: Let KeyFileData own a reference to the GKeyFile
    
    This makes the code more readable and robust against refactorings.

 src/daemon/goadaemon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
index 58ec109..cc5cf38 100644
--- a/src/daemon/goadaemon.c
+++ b/src/daemon/goadaemon.c
@@ -429,7 +429,7 @@ typedef struct
 static void
 key_file_data_free (KeyFileData *data)
 {
-  /* the key_file member is freed elsewhere */
+  g_key_file_unref (data->key_file);
   g_free (data->path);
   g_slice_free (KeyFileData, data);
 }
@@ -440,7 +440,7 @@ key_file_data_new (GKeyFile    *key_file,
 {
   KeyFileData *data;
   data = g_slice_new (KeyFileData);
-  data->key_file = key_file;
+  data->key_file = g_key_file_ref (key_file);
   data->path = g_strdup (path);
   return data;
 }


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