diff options
author | Felix Riemann <friemann@gnome.org> | 2023-05-06 19:45:55 +0200 |
---|---|---|
committer | Felix Riemann <friemann@gnome.org> | 2023-05-06 19:45:55 +0200 |
commit | e6e68c09d48b8a48e7afbe7a863aea257191139a (patch) | |
tree | c3d7aa520679ea7d9e77bfab08eb1ab0b4e0cd1d | |
parent | bf51a29403495242079bc798c51ce1bc9c3e276f (diff) | |
download | eog-e6e68c09d48b8a48e7afbe7a863aea257191139a.tar.gz |
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.
-rw-r--r-- | src/eog-window.c | 25 |
1 files 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"); |