diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2018-05-31 09:42:56 +1200 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2018-05-31 09:42:56 +1200 |
commit | cb1071b9ab6bf743d7c51545841dfadcbfe7ec9c (patch) | |
tree | 2a78da77f51e286d10e3b8f8ee95c7f6fd3e4f52 /tools | |
parent | 0e6cc20ca922a2985a43ec342eeeefe21082c348 (diff) |
lib: Add a new version of up_client_get_devices which unrefs contents
The existing function didn't set the free function on the GPtrArray.
This means a libupower user can easily make a mistake in the reference
counting of the array contents.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/up-tool.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/up-tool.c b/tools/up-tool.c index db31075..724e468 100644 --- a/tools/up-tool.c +++ b/tools/up-tool.c @@ -173,7 +173,7 @@ up_tool_do_monitor (UpClient *client) g_signal_connect (client, "device-removed", G_CALLBACK (up_tool_device_removed_cb), NULL); g_signal_connect (client, "notify", G_CALLBACK (up_tool_changed_cb), NULL); - devices = up_client_get_devices (client); + devices = up_client_get_devices2 (client); for (i=0; i < devices->len; i++) { UpDevice *device; device = g_ptr_array_index (devices, i); @@ -314,7 +314,7 @@ main (int argc, char **argv) if (opt_enumerate || opt_dump) { GPtrArray *devices; - devices = up_client_get_devices (client); + devices = up_client_get_devices2 (client); for (i=0; i < devices->len; i++) { device = (UpDevice*) g_ptr_array_index (devices, i); if (opt_enumerate) { |