# HG changeset patch # User Gu1 # Date 1282900772 -7200 # Node ID a4c75fe75869f2b89dbf83452139b23e41df09e0 # Parent 6afab419ff882beb09fb1eae53cdc7b172ad482c Fix the segfault when unloading the S5B module, by loading gio manually committer: Nicolas Cornu diff -r 6afab419ff88 -r a4c75fe75869 jingle-s5b/socks5.c --- a/jingle-s5b/socks5.c Thu Aug 26 19:08:21 2010 +0200 +++ b/jingle-s5b/socks5.c Fri Aug 27 11:19:32 2010 +0200 @@ -509,7 +509,18 @@ static void jingle_socks5_init(void) { - g_type_init(); + // ugly hack to fix the segfault when quitting: + // mcabber doesn't load gthread or gobject but they are required by gio, + // and cannot be unloaded once they are loaded or a segfault occur. + // We dlopen gio with global | nodelete flags. This will also load gobject + // and gthread as dependencies. g_type_init will init gobject/gthread (and + // set threads_got_initialized to true). + if (g_threads_got_initialized == FALSE) { + void *dlopen(const char *filename, int flag); + // RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE + dlopen("libgio-2.0.so", 0x00001 | 0x00100 | 0x01000); + g_type_init(); + } jingle_register_transport(NS_JINGLE_TRANSPORT_SOCKS5, &funcs, JINGLE_TRANSPORT_STREAMING, JINGLE_TRANSPORT_PRIO_HIGH); diff -r 6afab419ff88 -r a4c75fe75869 jingle/register.c --- a/jingle/register.c Thu Aug 26 19:08:21 2010 +0200 +++ b/jingle/register.c Fri Aug 27 11:19:32 2010 +0200 @@ -191,6 +191,6 @@ TransportHandlerEntry *entry = jingle_find_transport(xmlns); if (entry) { jingle_free_transport(entry); - jingle_transport_handlers = g_slist_remove(jingle_app_handlers, entry); + jingle_transport_handlers = g_slist_remove(jingle_transport_handlers, entry); } }