[gnome-control-center] power: Use g_signal_connect_object



commit f34ea2bd5ea90726f52aaad06c8d1cf125e7de10
Author: Andrea Azzarone <andrea azzarone canonical com>
Date:   Wed Oct 10 20:10:27 2018 +0100

    power: Use g_signal_connect_object
    
    Objects created using the object storage API are not disposed when the panel
    that created them is disposed. In order to prevent segfaults we need to manually
    disconnect signal handler connected to these objects or we can do it
    automatically using g_signal_connect_object.
    
    Fixes: https://launchpad.net/bugs/1797205

 panels/power/cc-power-panel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 0020e40cf..3af8aee32 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1717,8 +1717,9 @@ iio_proxy_appeared_cb (GDBusConnection *connection,
       return;
     }
 
-  g_signal_connect_swapped (G_OBJECT (self->iio_proxy), "g-properties-changed",
-                            G_CALLBACK (als_enabled_state_changed), self);
+  g_signal_connect_object (G_OBJECT (self->iio_proxy), "g-properties-changed",
+                           G_CALLBACK (als_enabled_state_changed), self,
+                           G_CONNECT_SWAPPED);
   als_enabled_state_changed (self);
 }
 


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