From f6c4fe108d6a180bdddccad0328c180afe14adf2 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Fri, 25 Aug 2023 17:18:16 -0300 Subject: [PATCH] core/calendar-monitor: Join view thread in dispose Joining the calendar view thread in finalize is too late; dispose is an earlier phase, and recoverable. Do that. Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1085 --- src/core/gcal-calendar-monitor.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/gcal-calendar-monitor.c b/src/core/gcal-calendar-monitor.c index 33622b64..22aec222 100644 --- a/src/core/gcal-calendar-monitor.c +++ b/src/core/gcal-calendar-monitor.c @@ -1234,7 +1234,7 @@ complete_in_idle_cb (gpointer user_data) */ static void -gcal_calendar_monitor_finalize (GObject *object) +gcal_calendar_monitor_dispose (GObject *object) { GcalCalendarMonitor *self = (GcalCalendarMonitor *)object; @@ -1249,6 +1249,16 @@ gcal_calendar_monitor_finalize (GObject *object) remove_all_events (self); + g_clear_object (&self->cancellable); + + G_OBJECT_CLASS (gcal_calendar_monitor_parent_class)->dispose (object); +} + +static void +gcal_calendar_monitor_finalize (GObject *object) +{ + GcalCalendarMonitor *self = (GcalCalendarMonitor *)object; + g_clear_object (&self->calendar); g_clear_pointer (&self->thread_context, g_main_context_unref); g_clear_pointer (&self->main_context, g_main_context_unref); @@ -1313,6 +1323,7 @@ gcal_calendar_monitor_class_init (GcalCalendarMonitorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = gcal_calendar_monitor_dispose; object_class->finalize = gcal_calendar_monitor_finalize; object_class->get_property = gcal_calendar_monitor_get_property; object_class->set_property = gcal_calendar_monitor_set_property;