[network-manager-applet] applet: fix a crash while sorting connections



commit 978bac67673130de51dd998c44696883a0ce5ffe
Author: Jiří Klimeš <jklimes redhat com>
Date:   Tue Mar 24 10:31:58 2015 +0100

    applet: fix a crash while sorting connections
    
    Compare function for g_ptr_array_sort() takes pointers to pointers to array
    items.
    
    Fixes commit 3722a190468f5ce5898db8838611bc826d3153f1.

 src/applet.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index efc345b..ba13cbb 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -1558,8 +1558,8 @@ add_device_items (NMDeviceType type, const GPtrArray *all_devices,
 static gint
 sort_connections_by_ifname (gconstpointer a, gconstpointer b)
 {
-       NMConnection *aa = NM_CONNECTION (a);
-       NMConnection *bb = NM_CONNECTION (b);
+       NMConnection *aa =  *(NMConnection **)a;
+       NMConnection *bb =  *(NMConnection **)b;
 
        return strcmp (nm_connection_get_interface_name (aa),
                       nm_connection_get_interface_name (bb));
@@ -1594,7 +1594,7 @@ add_virtual_items (const char *type, const GPtrArray *all_devices,
                 * (or reach the end of the list).
                 */
                while (   i < connections->len
-                      && sort_connections_by_ifname (connection, connections->pdata[i]) == 0)
+                      && sort_connections_by_ifname (&connection, &connections->pdata[i]) == 0)
                        i++;
        }
 
@@ -1618,7 +1618,7 @@ add_virtual_items (const char *type, const GPtrArray *all_devices,
 
                iface_connections = g_ptr_array_sized_new (5);
                while (   i < connections->len
-                      && sort_connections_by_ifname (connection, connections->pdata[i]) == 0) {
+                      && sort_connections_by_ifname (&connection, &connections->pdata[i]) == 0) {
                        g_ptr_array_add (iface_connections, connections->pdata[i]);
                        i++;
                }


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