From a7f73b0f0ea7f8efc4c94a6e0f6f3b913fe1bc45 Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Sat, 6 May 2023 19:15:39 +0200 Subject: EogMetadataSidebar: Release reference on parent window Otherwise the reference gets leaked and the parent window may not finalize correctly. This could cause further issues if some callbacks or bindings do not get disconnected due to the skipped finalization. Fixes #291. --- src/eog-metadata-sidebar.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/eog-metadata-sidebar.c b/src/eog-metadata-sidebar.c index 1363a6e5..c5757fc2 100644 --- a/src/eog-metadata-sidebar.c +++ b/src/eog-metadata-sidebar.c @@ -464,6 +464,8 @@ eog_metadata_sidebar_dispose (GObject *object) g_clear_object (&priv->image); + g_clear_object (&priv->parent_window); + G_OBJECT_CLASS (eog_metadata_sidebar_parent_class)->dispose (object); } -- cgit v1.2.1 From bf51a29403495242079bc798c51ce1bc9c3e276f Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Sat, 6 May 2023 19:24:46 +0200 Subject: EogWindow: Fix leaked references on the window's ThumbNav widget These would prevent the EogThumbNav from disposing/finalizing correctly. That would keep the GSettings binding for the "show-buttons" property alive as well. Although this doesn't seem to crash when triggered, it at least prints some worrying criticals into the log. Part of #291. --- src/eog-window.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/eog-window.c b/src/eog-window.c index ddbeff59..8c6dcbcd 100644 --- a/src/eog-window.c +++ b/src/eog-window.c @@ -343,6 +343,9 @@ eog_window_set_gallery_mode (EogWindow *window, if (priv->mode != EOG_WINDOW_MODE_UNKNOWN) { update_action_groups_state (window); } + + g_object_unref (priv->nav); + g_object_unref (hpaned); } static void -- cgit v1.2.1 From e6e68c09d48b8a48e7afbe7a863aea257191139a Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Sat, 6 May 2023 19:45:55 +0200 Subject: EogWindow: Release GSettings handlers for GActions EogWindow uses uses standard signal handlers to bind some GActions to GSettings properties. A binding cannot be used here. These callbacks were never disconnected though. If the GSettings object would not be finalized after closing the window (e.g. due to some still active bindings) it could still trigger the callback with a handle to a released GAction causing a segfault. Using `g_signal_connect_object` ensures the signal handler gets disconnected when the GAction is released. Fixes #291. --- src/eog-window.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/eog-window.c b/src/eog-window.c index 8c6dcbcd..1c8b54d0 100644 --- a/src/eog-window.c +++ b/src/eog-window.c @@ -4584,17 +4584,20 @@ eog_window_init (EogWindow *window) * not trigger the state changed handler since the state is updated directly * via the "state" property. Requesting a state change via these callbacks, * however, works. */ - g_signal_connect (priv->ui_settings, "changed::"EOG_CONF_UI_IMAGE_GALLERY, - G_CALLBACK (eog_window_ui_settings_changed_cb), - g_action_map_lookup_action (G_ACTION_MAP (window), "view-gallery")); - - g_signal_connect (priv->ui_settings, "changed::"EOG_CONF_UI_SIDEBAR, - G_CALLBACK (eog_window_ui_settings_changed_cb), - g_action_map_lookup_action (G_ACTION_MAP (window), "view-sidebar")); - - g_signal_connect (priv->ui_settings, "changed::"EOG_CONF_UI_STATUSBAR, - G_CALLBACK (eog_window_ui_settings_changed_cb), - g_action_map_lookup_action (G_ACTION_MAP (window), "view-statusbar")); + g_signal_connect_object (priv->ui_settings, "changed::"EOG_CONF_UI_IMAGE_GALLERY, + G_CALLBACK (eog_window_ui_settings_changed_cb), + g_action_map_lookup_action (G_ACTION_MAP (window), "view-gallery"), + G_CONNECT_DEFAULT); + + g_signal_connect_object (priv->ui_settings, "changed::"EOG_CONF_UI_SIDEBAR, + G_CALLBACK (eog_window_ui_settings_changed_cb), + g_action_map_lookup_action (G_ACTION_MAP (window), "view-sidebar"), + G_CONNECT_DEFAULT); + + g_signal_connect_object (priv->ui_settings, "changed::"EOG_CONF_UI_STATUSBAR, + G_CALLBACK (eog_window_ui_settings_changed_cb), + g_action_map_lookup_action (G_ACTION_MAP (window), "view-statusbar"), + G_CONNECT_DEFAULT); action = g_action_map_lookup_action (G_ACTION_MAP (window), "current-image"); -- cgit v1.2.1