[Spice-devel] [PATCH spice-gtk 4/7] usb-device-manager: Move devices and channels to USE_USBREDIR section

Frediano Ziglio fziglio at redhat.com
Thu Jul 11 13:00:51 UTC 2019


These fields are not used if USE_USBREDIR is not set.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/usb-device-manager.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 4b126896..dbb78390 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -107,10 +107,10 @@ struct _SpiceUsbDeviceManagerPrivate {
     HANDLE usbdk_hider_handle;
 #else
     gboolean redirecting; /* Handled by GUdevClient in the gudev case */
-#endif
 #endif
     GPtrArray *devices;
     GPtrArray *channels;
+#endif
 };
 
 enum {
@@ -246,8 +246,8 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
         spice_debug("UsbDk driver is not installed");
     }
 #endif
-    priv->channels = g_ptr_array_new();
 #ifdef USE_USBREDIR
+    priv->channels = g_ptr_array_new();
     priv->devices  = g_ptr_array_new_with_free_func((GDestroyNotify)
                                                     spice_usb_device_unref);
 #endif
@@ -343,11 +343,11 @@ static void spice_usb_device_manager_finalize(GObject *gobject)
     SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(gobject);
     SpiceUsbDeviceManagerPrivate *priv = self->priv;
 
+#ifdef USE_USBREDIR
     g_ptr_array_unref(priv->channels);
-    if (priv->devices)
+    if (priv->devices) {
         g_ptr_array_unref(priv->devices);
-
-#ifdef USE_USBREDIR
+    }
 #ifdef G_OS_WIN32
     g_clear_object(&priv->udev);
 #endif
-- 
2.20.1



More information about the Spice-devel mailing list