From 539a8247acabfba21bbcb20ff14793f92ba34d4c Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 3 Jan 2017 23:17:47 +0100
Subject: Deleted lines from memory as expected.

---
 ChangeLog                  |  5 +++++
 src/glibext/gbuffercache.c | 32 ++++++++++++++++++++++++++------
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 77106be..790599c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+17-01-03  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/glibext/gbuffercache.c:
+	Delete lines from memory as expected.
+
 17-01-02  Cyrille Bagard <nocbos@gmail.com>
 
 	* plugins/pychrysa/arch/instruction.c:
diff --git a/src/glibext/gbuffercache.c b/src/glibext/gbuffercache.c
index 37a9492..926d034 100644
--- a/src/glibext/gbuffercache.c
+++ b/src/glibext/gbuffercache.c
@@ -87,6 +87,9 @@ static void on_line_ref_toggle(cache_info *, GBufferLine *, gboolean);
 static GBufferLine *get_cache_info_line(cache_info *, size_t);
 
 /* Force la réinitialisation d'une éventuelle ligne cachée. */
+static void _reset_cache_info_line_unlocked(cache_info *);
+
+/* Force la réinitialisation d'une éventuelle ligne cachée. */
 static void reset_cache_info_line(cache_info *);
 
 
@@ -396,7 +399,7 @@ static void on_line_ref_toggle(cache_info *info, GBufferLine *line, gboolean las
 
         assert(info->line != NULL);
 
-        info->line = NULL;
+        _reset_cache_info_line_unlocked(info);
 
         G_UNLOCK(_line_update);
 
@@ -466,20 +469,37 @@ static GBufferLine *get_cache_info_line(cache_info *info, size_t index)
 *                                                                             *
 ******************************************************************************/
 
-static void reset_cache_info_line(cache_info *info)
+static void _reset_cache_info_line_unlocked(cache_info *info)
 {
-    G_LOCK(_line_update);
-
     if (info->line != NULL)
     {
         g_object_remove_toggle_ref(G_OBJECT(info->line), (GToggleNotify)on_line_ref_toggle, info);
 
-        g_object_unref(G_OBJECT(info->line));
-
         info->line = NULL;
 
     }
 
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : info = informations sur une ligne à venir manipuler.         *
+*                                                                             *
+*  Description : Force la réinitialisation d'une éventuelle ligne cachée.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void reset_cache_info_line(cache_info *info)
+{
+    G_LOCK(_line_update);
+
+    _reset_cache_info_line_unlocked(info);
+
     G_UNLOCK(_line_update);
 
 }
-- 
cgit v0.11.2-87-g4458