[gnome-control-center] power: Use up_client_get_devices2()



commit c1210c5c65b3c7821220e9cb6918183324df96b0
Author: Philip Chimento <philip endlessm com>
Date:   Fri Sep 13 17:41:08 2019 -0700

    power: Use up_client_get_devices2()
    
    The previous code would have leaked all the UpDevice objects because no
    free function was set on the returned GPtrArray.
    
    Since we already depend on upower-glib 0.99.8 which is the release in
    which get_devices() was deprecated and get_devices2() was introduced, we
    can simply switch to get_devices2() which does set a free function on
    the returned GPtrArray, stopping the leak.

 panels/power/cc-power-panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index c31249c51..f213bbae5 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1350,7 +1350,7 @@ set_ac_battery_ui_mode (CcPowerPanel *self)
   GPtrArray *devices;
   guint i;
 
-  devices = up_client_get_devices (self->up_client);
+  devices = up_client_get_devices2 (self->up_client);
   g_debug ("got %d devices from upower\n", devices ? devices->len : 0);
 
   for (i = 0; devices != NULL && i < devices->len; i++)


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