From 0e22ad78613c2c4222336af282b75e1151a45df9 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 3 Feb 2020 17:15:23 +0000 Subject: [PATCH] =?UTF-8?q?malcontent-control:=20Use=20g=5Fsignal=5Fconnec?= =?UTF-8?q?t=5Fobject()=20when=20we=20don=E2=80=99t=20hold=20ref?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The application doesn’t hold a ref to some of the widgets it holds a pointer to, since their ownership is controlled by the main window. The main window’s lifecycle is controlled by the application, but its dispose cycle runs at a slightly different time. Hence, we should disconnect from the widget signals when we can, but without holding a strong ref. --- malcontent-control/application.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/malcontent-control/application.c b/malcontent-control/application.c index d2b69a4..7a0ca34 100644 --- a/malcontent-control/application.c +++ b/malcontent-control/application.c @@ -148,9 +148,9 @@ mct_application_activate (GApplication *application) self->error_message = GTK_LABEL (gtk_builder_get_object (builder, "error_message")); /* Connect signals. */ - g_signal_connect (self->user_selector, "notify::user", - G_CALLBACK (user_selector_notify_user_cb), - self); + g_signal_connect_object (self->user_selector, "notify::user", + G_CALLBACK (user_selector_notify_user_cb), + self, 0 /* flags */); g_signal_connect (self->user_manager, "notify::is-loaded", G_CALLBACK (user_manager_notify_is_loaded_cb), self);