[gnome-calendar/gnome-3-36] timeline: Don't try to use removed subscribers



commit 896c6099da06af30af3e22e38eb0d1c8b5b3846d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 15 18:47:19 2020 -0300

    timeline: Don't try to use removed subscribers
    
    Because the timeline is essentially asynchronous, it may
    try and process events after their subscribers were removed.
    
    Protect against that.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/576

 src/core/gcal-timeline.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/core/gcal-timeline.c b/src/core/gcal-timeline.c
index f4db58f1..b5d683fb 100644
--- a/src/core/gcal-timeline.c
+++ b/src/core/gcal-timeline.c
@@ -589,6 +589,13 @@ timeline_source_dispatch (GSource     *source,
       subscriber = queue_data->subscriber;
       event_range = gcal_event_get_range (event);
 
+      /* The subscriber may have been removed already */
+      if (!g_hash_table_contains (self->subscribers, subscriber))
+        {
+          queue_data_free (queue_data);
+          continue;
+        }
+
       switch (queue_data->queue_event)
         {
         case ADD_EVENT:


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