[gnome-logs/wip/jonathankang/fix-mem-leak: 3/3] free GlQuery when journal model is disposing



commit 1a795d97edce78724eab0369d7cc4c926128c5c8
Author: Jonathan Kang <jonathankang gnome org>
Date:   Mon Mar 19 15:35:56 2018 +0800

    free GlQuery when journal model is disposing
    
    GlJournalModel contains GlQuery in its private structure. And GlQuery
    should be free using gl_query_free() to avoid memory leak.

 src/gl-journal-model.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gl-journal-model.c b/src/gl-journal-model.c
index 4bb2030..ea68cea 100644
--- a/src/gl-journal-model.c
+++ b/src/gl-journal-model.c
@@ -67,6 +67,7 @@ static gboolean gl_query_check_journal_end (GlQuery *query, GlJournalEntry *entr
 static gboolean gl_row_entry_check_message_similarity (GlRowEntry *current_row_entry,
                                                        GlRowEntry *prev_row_entry);
 static void gl_journal_model_add_header (GlJournalModel *model);
+static void gl_query_free (GlQuery *query);
 
 
 G_DEFINE_TYPE (GlRowEntry, gl_row_entry, G_TYPE_OBJECT);
@@ -269,6 +270,11 @@ gl_journal_model_dispose (GObject *object)
 
     gl_journal_model_stop_idle (model);
 
+    if (model->query)
+    {
+        gl_query_free (model->query);
+    }
+
     if (model->entries)
     {
         g_ptr_array_free (model->entries, TRUE);


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