From 97626c467f5f0a468bef5367914c3186de190be0 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Thu, 18 Aug 2022 20:57:46 +0200 Subject: [PATCH] ringer: Move libfeedback related cleanup to finalize() Leave the LfbEvent self->event alive in dispose() to give potentially pending GAsyncReadyCallback invocations or running GSources a better chance of finishing gracefully. --- src/calls-ringer.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/calls-ringer.c b/src/calls-ringer.c index 05ade8e..ca65625 100644 --- a/src/calls-ringer.c +++ b/src/calls-ringer.c @@ -463,10 +463,6 @@ dispose (GObject *object) { CallsRinger *self = CALLS_RINGER (object); - if (self->event) { - g_clear_object (&self->event); - lfb_uninit (); - } g_signal_handlers_disconnect_by_data (calls_manager_get_default (), self); g_clear_handle_id (&self->restart_id, g_source_remove); @@ -475,6 +471,20 @@ dispose (GObject *object) } +static void +finalize (GObject *object) +{ + CallsRinger *self = CALLS_RINGER (object); + + if (self->event) + lfb_uninit (); + + g_clear_object (&self->event); + + G_OBJECT_CLASS (calls_ringer_parent_class)->finalize (object); +} + + static void calls_ringer_class_init (CallsRingerClass *klass) { @@ -482,6 +492,7 @@ calls_ringer_class_init (CallsRingerClass *klass) object_class->constructed = constructed; object_class->dispose = dispose; + object_class->finalize = finalize; object_class->get_property = get_property; props[PROP_IS_RINGING] =