#include #include #define MAGIC_COOKIE ((void*)(intptr_t) 0xDEAFBABE) static void on_close(VortexConnection* connection, axlPointer userdata) { assert( userdata == MAGIC_COOKIE ); connection; } int main(int argc, char* argv[]) { bool is_ok; VortexConnection* connection; void* userdata; is_ok = vortex_init(); assert( is_ok ); connection = vortex_connection_new("0.0.0.0", "44000", NULL, NULL); vortex_connection_set_on_close_full(connection, on_close, MAGIC_COOKIE); userdata = vortex_connection_remove_on_close_full(connection, on_close); assert( userdata == MAGIC_COOKIE ); // this assert should not fail, but it does userdata = vortex_connection_remove_on_close_full(connection, on_close); assert( !userdata ); vortex_connection_shutdown(connection); // on_close sometimes get called here... vortex_exit(); return 0; }