When I use win32,the calling convention in glib and libusb is different
When I compile spicy with mingw32: In the libusb,the calling convention is pascal(stdcall):
#define API_EXPORTED LIBUSB_CALL DEFAULT_VISIBILITY
#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
#define LIBUSB_CALL WINAPI
#else
#define LIBUSB_CALL
#endif
#define WINAPI FAR PASCAL
#define PASCAL _pascal
But in the glib,the calling is cdecl:
// glib: gmem.h
typedef void (*GDestroyNotify) (gpointer data);
#define g_clear_pointer(pp, destroy) \
G_STMT_START { \
G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \
/* Only one access, please */ \
gpointer *_pp = (gpointer *) (pp); \
gpointer _p; \
/* This assignment is needed to avoid a gcc warning */ \
GDestroyNotify _destroy = (GDestroyNotify) (destroy); \
\
_p = *_pp; \
if (_p) \
{ \
*_pp = NULL; \
_destroy (_p); \
} \
} G_STMT_END
// spice-client: channel-usbredir.c
g_clear_pointer(&priv->device, libusb_unref_device);
so the stack is broken