[Spice-devel,spice-gtk,Win32,5/7] Windows usb: Comment out some memory cleanups not working on Windows

Submitted by Uri Lublin on May 7, 2012, 1:15 p.m.

Details

Message ID 1336396539-9476-6-git-send-email-uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin May 7, 2012, 1:15 p.m.
It's not nice, but better than crashing.
---
 gtk/usb-device-manager.c |    9 +++++++++
 gtk/usbutil.c            |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index b60f1f0..377b774 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -143,9 +143,14 @@  static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)

     priv->channels = g_ptr_array_new();
 #ifdef USE_USBREDIR
+#ifdef WIN32
+    /* FIXME WIN32 use g_ptr_array_new_with_free_func */
+    priv->devices  = g_ptr_array_new();
+#else
     priv->devices  = g_ptr_array_new_with_free_func((GDestroyNotify)
                                                     libusb_unref_device);
 #endif
+#endif
 }

 static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
@@ -206,6 +211,8 @@  static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     g_signal_connect(G_OBJECT(priv->udev), "uevent",
                      G_CALLBACK(spice_usb_device_manager_uevent_cb), self);

+/* FIXME: fix coldplug for WIN32 */
+#ifndef WIN32
     /* Do coldplug (detection of already connected devices) */
     libusb_get_device_list(priv->context, &priv->coldplug_list);
     list = g_udev_client_query_by_subsystem(priv->udev, "usb");
@@ -216,6 +223,7 @@  static gboolean spice_usb_device_manager_initable_init(GInitable  *initable,
     g_list_free(list);
     libusb_free_device_list(priv->coldplug_list, 1);
     priv->coldplug_list = NULL;
+#endif

     return TRUE;
 #else
@@ -235,6 +243,7 @@  static void spice_usb_device_manager_finalize(GObject *gobject)
         g_ptr_array_unref(priv->devices);

 #ifdef USE_USBREDIR
+/* FIXME: verify WIN32 cleanup*/
     g_clear_object(&priv->udev);
     if (priv->context)
         libusb_exit(priv->context);
diff --git a/gtk/usbutil.c b/gtk/usbutil.c
index 704f973..fd3d2de 100644
--- a/gtk/usbutil.c
+++ b/gtk/usbutil.c
@@ -233,6 +233,7 @@  void spice_usb_util_get_device_strings(int bus, int address,
     *manufacturer = NULL;
     *product = NULL;

+/* FIXME: add windows support for "manufacturer" & "product" */
 #if __linux__
     *manufacturer = spice_usbutil_get_sysfs_attribute(bus, address, "manufacturer");
     *product = spice_usbutil_get_sysfs_attribute(bus, address, "product");