From 46a2ca574fdb0121d27b6d148bed354061adf1d4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 23 Sep 2013 10:44:41 +0100 Subject: Initialize libdbus for thread-safety libdbus is not thread-safe by default. This is a long-standing design flaw (). We call into GIO, which calls into glib-networking, which can (at least in recent versions) invoke libproxy in a thread. libproxy apparently has a Network-Manager plugin, which uses libdbus in that thread; meanwhile, we use libdbus in the main thread and everything goes badly for us. In libdbus < 1.7.4, libraries cannot safely initialize libdbus for multi-threading, because that initialization is not itself thread-safe (!); in particular, glib-networking cannot safely initialize libdbus. So, we have to do it. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65296 [copied from Gabble commit 83bb468e -smcv] Signed-off-by: Simon McVittie --- src/salut.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/salut.c b/src/salut.c index 8b7f2893..f61c29fe 100644 --- a/src/salut.c +++ b/src/salut.c @@ -1,5 +1,7 @@ #include "config.h" +#include + #include #include @@ -45,6 +47,9 @@ main (int argc, char **argv) gint ret; SalutPluginLoader *loader; + if (!dbus_threads_init_default ()) + g_error ("Unable to initialize libdbus thread-safety (out of memory?)"); + g_type_init (); salut_symbol_hacks (); -- cgit v1.2.1