[gnome-calendar/mcatanzaro/timeline-source-leak] timeline: fix leak of timeline source



commit 17a69f235f1e56364827d3b7f27701b608c8ad1e
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Apr 14 17:02:12 2020 -0500

    timeline: fix leak of timeline source
    
    g_source_destroy doesn't free memory, just removes the source from its
    main context. We have to do both. (g_source_unref() might call
    g_source_destroy() if it has the last ref, but if something else has
    another ref, then disaster could result if we don't call it manually.)

 src/core/gcal-timeline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/core/gcal-timeline.c b/src/core/gcal-timeline.c
index ec85cdfb..9040585d 100644
--- a/src/core/gcal-timeline.c
+++ b/src/core/gcal-timeline.c
@@ -681,7 +681,9 @@ gcal_timeline_finalize (GObject *object)
   g_clear_pointer (&self->calendars, g_hash_table_destroy);
   g_clear_pointer (&self->subscribers, g_hash_table_destroy);
   g_clear_pointer (&self->subscriber_ranges, gcal_range_tree_unref);
-  g_clear_pointer (&self->timeline_source, g_source_destroy);
+
+  g_source_destroy (self->timeline_source);
+  g_clear_pointer (&self->timeline_source, g_source_unref);
 
   if (self->event_queue)
     {


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