battstat: fix deprecated up_client_get_devices#487
Conversation
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.
|
I think that we can also bump upower to 0.99.8 and remove legacy code. Line 21 in 01e8f8a |
|
You're right, done. |
e203325 to
60e6dd1
Compare
|
Origin comment was taken from mate-desktop/mate-power-manager@9d5b257 I think it is more a leak in upower itself. |
|
Using a global variable makes more sense like in #443, since the list of devices is updated dynamically and specific events are triggered. |
|
I only wanted to fix the deprecation. Any improvements can be done in another PR. |
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.