malcontent-control: Use g_signal_connect_object() when we don’t hold ref

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.
This commit is contained in:
Philip Withnall 2020-02-03 17:15:23 +00:00
parent 8c904a61ee
commit 0e22ad7861
1 changed files with 3 additions and 3 deletions

View File

@ -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);