[PATCH spice-gtk 07/14] usb: remove useless device ref/unref

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

 



A code doing an unref() on an object just before manipulating it looks
horribly suspicious...
---
 gtk/usb-device-manager.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index a505c19..af993aa 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1094,10 +1094,8 @@ static void spice_usb_device_manager_drv_install_cb(GObject *gobject,
         g_error_free(err);
     }
 
-    spice_usb_device_unref(device);
     spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_INSTALLED);
 
-    /* device is already ref'ed */
     _spice_usb_device_manager_connect_device_async(self,
                                                    device,
                                                    cancellable,
@@ -1122,7 +1120,6 @@ static void spice_usb_device_manager_drv_uninstall_cb(GObject *gobject,
         g_clear_error(&err);
     }
 
-    spice_usb_device_unref(cbinfo->device);
     spice_usb_device_set_state(cbinfo->device, SPICE_USB_DEVICE_STATE_NONE);
 
     g_free(cbinfo);
@@ -1490,7 +1487,7 @@ void spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
     installer = self->priv->installer;
     cbinfo = g_new0(UsbInstallCbInfo, 1);
     cbinfo->manager     = self;
-    cbinfo->device      = spice_usb_device_ref(device);
+    cbinfo->device      = device;
     cbinfo->installer   = installer;
     cbinfo->cancellable = cancellable;
     cbinfo->callback    = callback;
@@ -1566,7 +1563,7 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
     installer = self->priv->installer;
     cbinfo = g_new0(UsbInstallCbInfo, 1);
     cbinfo->manager     = self;
-    cbinfo->device      = spice_usb_device_ref(device);
+    cbinfo->device      = device;
     cbinfo->installer   = installer;
     cbinfo->cancellable = NULL;
     cbinfo->callback    = NULL;
-- 
1.8.5.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]