From 1d6dee8bbbe84185116ce629c50940acaef3956d Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 13 Jul 2019 19:51:02 -0300 Subject: [PATCH] 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));