[gnome-settings-daemon/benzea/minor-fix-collection: 47/51] power, color: Use g_signal_connect_object for the session manager



commit 438bb2fcc3bf365fd48be6dfa2b46ab0d0ffff34
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Mar 25 10:43:00 2019 +0100

    power,color: Use g_signal_connect_object for the session manager
    
    The session manager object is globally shared and may live longer than
    the GSD plugin manager object. Use g_signal_connect_object rathre than
    g_signal_connect to prevent callbacks to destroyed objects.
    
    This is a theoretical issue, no impact has been seen from this.

 plugins/color/gsd-color-state.c   | 5 +++--
 plugins/power/gsd-power-manager.c | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/plugins/color/gsd-color-state.c b/plugins/color/gsd-color-state.c
index c9b526d9..fcc56fc5 100644
--- a/plugins/color/gsd-color-state.c
+++ b/plugins/color/gsd-color-state.c
@@ -1366,8 +1366,9 @@ gcm_session_client_connect_cb (GObject *source_object,
         }
 
         /* watch if sessions change */
-        g_signal_connect (state->session, "g-properties-changed",
-                          G_CALLBACK (gcm_session_active_changed_cb), state);
+        g_signal_connect_object (state->session, "g-properties-changed",
+                                 G_CALLBACK (gcm_session_active_changed_cb),
+                                 state, 0);
 
         /* add screens */
         gnome_rr_screen_refresh (state->state_screen, &error);
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index beacc4ff..92491905 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -2423,9 +2423,9 @@ on_rr_screen_acquired (GObject      *object,
 
         /* track the active session */
         manager->session = gnome_settings_bus_get_session_proxy ();
-        g_signal_connect (manager->session, "g-properties-changed",
-                          G_CALLBACK (engine_session_properties_changed_cb),
-                          manager);
+        g_signal_connect_object (manager->session, "g-properties-changed",
+                                 G_CALLBACK (engine_session_properties_changed_cb),
+                                 manager, 0);
         manager->session_is_active = is_session_active (manager);
 
         manager->screensaver_proxy = gnome_settings_bus_get_screen_saver_proxy ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]