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.
This commit is contained in:
Georges Basile Stavracas Neto
2019-07-13 19:51:02 -03:00
parent f0060b7699
commit 1d6dee8bbb
+2 -1
View File
@@ -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));