summaryrefslogtreecommitdiff
path: root/battstat
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2020-07-14 11:33:08 +0200
committerraveit65 <[email protected]>2020-07-14 16:19:54 +0200
commit06feef78296f3a2d3a5a3d1f653d38e7bf122015 (patch)
treef79f91d10340cad6d02354629ae3b82ef97c52b0 /battstat
parent01e8f8a09ab273719bdf0869f9f8693cb45d302e (diff)
downloadmate-applets-06feef78296f3a2d3a5a3d1f653d38e7bf122015.tar.bz2
mate-applets-06feef78296f3a2d3a5a3d1f653d38e7bf122015.tar.xz
batstatt: fix deprecated up_client_get_devices
The previous code would have leaked all the UpDevice objects because no free function was set on the returned GPtrArray. With depending on upower-glib 0.99.8 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.
Diffstat (limited to 'battstat')
-rw-r--r--battstat/battstat-upower.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/battstat/battstat-upower.c b/battstat/battstat-upower.c
index c22d50c7..2e8b4b4c 100644
--- a/battstat/battstat-upower.c
+++ b/battstat/battstat-upower.c
@@ -89,7 +89,7 @@ battstat_upower_initialise (void (*callback) (void))
#if UP_CHECK_VERSION(0, 99, 0)
GPtrArray *devices;
- devices = up_client_get_devices(upc);
+ devices = up_client_get_devices2 (upc);
if (!devices) {
goto error_shutdownclient;
}
@@ -149,7 +149,7 @@ void
battstat_upower_get_battery_info( BatteryStatus *status )
{
- GPtrArray *devices = up_client_get_devices( upc );
+ GPtrArray *devices = up_client_get_devices2 (upc);
/* The calculation to get overall percentage power remaining is as follows:
*