# HG changeset patch # User Ethan Blanton # Date 1155591977 0 # Node ID dabbcb9b013d9107882770c0f3b829187774e770 # Parent 8af7f3a7015f667bc860e3e3489c668aa061f930 [gaim-migrate @ 16759] This initializes threads for glib and dbus, because under some circumstances multithreaded libraries are causing dbus badness (namely, gnome-vfs). This fix doesn't really belong in Gaim, but in the interest of expedience (we don't want to wait for upstream libraries to get their initializations all worked around to make things safe) the fix goes here. Note that all Gaim frontends will have to initialize glib threads if other threaded libraries which interact with glib or dbus or what-have-you come into play. committer: Tailor Script diff -r 8af7f3a7015f -r dabbcb9b013d configure.ac --- a/configure.ac Mon Aug 14 08:32:52 2006 +0000 +++ b/configure.ac Mon Aug 14 21:46:17 2006 +0000 @@ -636,7 +636,7 @@ AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([ *** GLib 2.0 is required to build Gaim; please make sure you have the GLib *** development headers installed. The latest version of GLib is -*** always available at http://www.gtk.org/.])) +*** always available at http://www.gtk.org/.]),gthread) AM_PATH_GTK_2_0(2.0.0,,AC_MSG_ERROR([ *** GTK+ 2.0 is required to build Gaim; please make sure you have the GTK+ *** development headers installed. The latest version of GTK+ is diff -r 8af7f3a7015f -r dabbcb9b013d src/Makefile.am --- a/src/Makefile.am Mon Aug 14 08:32:52 2006 +0000 +++ b/src/Makefile.am Mon Aug 14 21:46:17 2006 +0000 @@ -339,6 +339,7 @@ gaim_LDFLAGS = -export-dynamic gaim_LDADD = \ @LIBOBJS@ \ + $(GLIB_LIBS) \ $(GTK_LIBS) \ $(DBUS_LIBS) \ $(GSTREAMER_LIBS) \ diff -r 8af7f3a7015f -r dabbcb9b013d src/dbus-server.c --- a/src/dbus-server.c Mon Aug 14 08:32:52 2006 +0000 +++ b/src/dbus-server.c Mon Aug 14 21:46:17 2006 +0000 @@ -757,6 +757,9 @@ void gaim_dbus_init(void) { + if (g_thread_supported()) + dbus_g_thread_init(); + gaim_dbus_init_ids(); g_free(init_error); diff -r 8af7f3a7015f -r dabbcb9b013d src/gtkmain.c --- a/src/gtkmain.c Mon Aug 14 08:32:52 2006 +0000 +++ b/src/gtkmain.c Mon Aug 14 21:46:17 2006 +0000 @@ -643,6 +643,15 @@ gtk_rc_add_default_file(search_path); g_free(search_path); +#if (defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)) + /* Since threads can be yanked in all unawares by other libraries, + * and some libraries aren't smart enough to initialize the thread + * subsystem when they need it, we need to do this here. We also + * threadify dbus when that gets initialized. Ugh. */ + if (!g_thread_supported()) + g_thread_init(NULL); + gdk_threads_init(); +#endif /* Glib has threads */ gui_check = gtk_init_check(&argc, &argv); if (!gui_check) {