[gnome-bluetooth] settings-widget: Cleanup proxy refcount with g_autoptr



commit 2f49a23117d78fade004acbff8b3cb4913d07c8c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Oct 28 13:35:25 2021 -0300

    settings-widget: Cleanup proxy refcount with g_autoptr
    
    A small cleanup to avoid manual reference management.
    
    See https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/issues/98

 lib/bluetooth-settings-widget.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index c844997a..09f427cb 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -852,7 +852,7 @@ turn_off_pairing (BluetoothSettingsWidget *self,
        for (child = gtk_widget_get_first_child (priv->device_list);
             child != NULL;
             child = gtk_widget_get_next_sibling (child)) {
-               GDBusProxy *proxy;
+               g_autoptr(GDBusProxy) proxy = NULL;
 
                if (!GTK_IS_LIST_BOX_ROW (child))
                        continue;
@@ -860,10 +860,8 @@ turn_off_pairing (BluetoothSettingsWidget *self,
                g_object_get (G_OBJECT (child), "proxy", &proxy, NULL);
                if (g_strcmp0 (g_dbus_proxy_get_object_path (proxy), object_path) == 0) {
                        g_object_set (G_OBJECT (child), "pairing", FALSE, NULL);
-                       g_object_unref (proxy);
                        break;
                }
-               g_object_unref (proxy);
        }
 }
 


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