Avoid passing libusb functions as callbacks
When building spice-gtk for windows: - libusb uses __stdcall calling convention when compiled for win32. It does not include an option to be compiled with __cdecl calling convention. Directly calling libusb functions works fine. But it is a problem when its functions are passed as callbacks to a function that expects other calling convention. - glib uses __cdecl calling convention and expects the functions it receives as parameters to follow __cdecl convention. So the lines included in spice-gtk like: g_clear_pointer(&priv->device, libusb_unref_device); cause libusb_unref_device (compiled with _stdcall convention) to be called with __cdecl convention. This causes stack corruption, and hence crashes. Related: https://gitlab.gnome.org/GNOME/glib/issues/1494 Acked-by: Victor Toso <victortoso@redhat.com>
Loading
-
mentioned in issue #79 (closed)
-
mentioned in issue spice/win32/usbdk#1 (closed)
Please register or sign in to comment