summaryrefslogtreecommitdiff
path: root/src/linux/up-device-supply.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linux/up-device-supply.c')
-rw-r--r--src/linux/up-device-supply.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index ad86ede..94bc615 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -511,6 +511,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
gboolean ac_online = FALSE;
gboolean has_ac = FALSE;
gboolean online;
+ UpDeviceList *devices_list;
GPtrArray *devices;
guint i;
@@ -699,7 +700,8 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
/* If we have any online AC, assume charging, otherwise
* discharging */
- devices = up_device_list_get_array (up_daemon_get_device_list (daemon));
+ devices_list = up_daemon_get_device_list (daemon);
+ devices = up_device_list_get_array (devices_list);
for (i=0; i < devices->len; i++) {
if (up_device_get_online ((UpDevice *) g_ptr_array_index (devices, i), &online)) {
has_ac = TRUE;
@@ -710,6 +712,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
}
}
g_ptr_array_unref (devices);
+ g_object_unref (devices_list);
if (has_ac) {
if (ac_online) {