diff options
author | rbuj <[email protected]> | 2021-10-24 19:02:56 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-03-10 23:16:43 +0100 |
commit | 2707880e8f55e27a6037bb8a3403254c150f4469 (patch) | |
tree | a6bbe6bdd7b0e2f0c6b9ff5d70726ce3df8c026c /plugins | |
parent | 9fca35700e99e5a4afee36a76716d3435626d7e0 (diff) | |
download | mate-settings-daemon-2707880e8f55e27a6037bb8a3403254c150f4469.tar.bz2 mate-settings-daemon-2707880e8f55e27a6037bb8a3403254c150f4469.tar.xz |
housekeeping: disconnect manager's changed settings signal on finalize
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/housekeeping/msd-housekeeping-manager.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/plugins/housekeeping/msd-housekeeping-manager.c b/plugins/housekeeping/msd-housekeeping-manager.c index 1f876b3..367cbb1 100644 --- a/plugins/housekeeping/msd-housekeeping-manager.c +++ b/plugins/housekeeping/msd-housekeeping-manager.c @@ -44,6 +44,7 @@ struct _MsdHousekeepingManager { guint long_term_cb; guint short_term_cb; GSettings *settings; + gulong config_listener_id; }; G_DEFINE_TYPE (MsdHousekeepingManager, msd_housekeeping_manager, G_TYPE_OBJECT) @@ -244,13 +245,6 @@ msd_housekeeping_manager_start (MsdHousekeepingManager *manager, g_debug ("Starting housekeeping manager"); mate_settings_profile_start (NULL); - msd_ldsm_setup (FALSE); - - manager->settings = g_settings_new (THUMB_CACHE_SCHEMA); - - g_signal_connect (manager->settings, "changed", - G_CALLBACK (settings_changed_callback), manager); - /* Clean once, a few minutes after start-up */ do_cleanup_soon (manager); @@ -266,7 +260,23 @@ msd_housekeeping_manager_start (MsdHousekeepingManager *manager, static void msd_housekeeping_manager_finalize (GObject *object) { - msd_housekeeping_manager_stop (MSD_HOUSEKEEPING_MANAGER (object)); + MsdHousekeepingManager *manager = MSD_HOUSEKEEPING_MANAGER (object); + msd_housekeeping_manager_stop (manager); +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&manager->config_listener_id, + manager->settings); +#else + if (manager->config_listener_id != 0) { + g_signal_handler_disconnect (manager->settings, + manager->config_listener_id); + manager->config_listener_id = 0; + } +#endif + g_object_unref (manager->settings); + manager->settings = NULL; + + msd_ldsm_clean (); + G_OBJECT_CLASS (msd_housekeeping_manager_parent_class)->finalize (object); } @@ -292,11 +302,6 @@ msd_housekeeping_manager_stop (MsdHousekeepingManager *manager) do_cleanup (manager); } } - - g_object_unref (manager->settings); - manager->settings = NULL; - - msd_ldsm_clean (); } static void @@ -310,6 +315,12 @@ msd_housekeeping_manager_class_init (MsdHousekeepingManagerClass *klass) static void msd_housekeeping_manager_init (MsdHousekeepingManager *manager) { + msd_ldsm_setup (FALSE); + + manager->settings = g_settings_new (THUMB_CACHE_SCHEMA); + manager->config_listener_id = g_signal_connect (manager->settings, "changed", + G_CALLBACK (settings_changed_callback), + manager); } MsdHousekeepingManager * |