[gnome-calendar] manager: Avoid reentrancy



commit 1d6dee8bbbe84185116ce629c50940acaef3956d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jul 13 19:51:02 2019 -0300

    manager: Avoid reentrancy
    
    While deleting the calendar, we may run into a situation
    where the GcalCalendar instance is destroyed before the
    GcalManager:calendar-removed signal is emitted, causing
    us to emit the signal with a destroyed object.
    
    Prevent that by increasing the ref count before emiting
    the signal.

 src/core/gcal-manager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/core/gcal-manager.c b/src/core/gcal-manager.c
index 51619906..f527e912 100644
--- a/src/core/gcal-manager.c
+++ b/src/core/gcal-manager.c
@@ -153,7 +153,7 @@ static void
 remove_source (GcalManager  *self,
                ESource      *source)
 {
-  GcalCalendar *calendar;
+  g_autoptr (GcalCalendar) calendar = NULL;
 
   GCAL_ENTRY;
 
@@ -161,6 +161,7 @@ remove_source (GcalManager  *self,
   g_return_if_fail (E_IS_SOURCE (source));
 
   calendar = g_hash_table_lookup (self->clients, source);
+  g_object_ref (calendar);
 
   e_cal_data_model_remove_client (self->e_data_model,
                                   e_source_get_uid (source));


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