path: root/src/dbus/qdbus_symbols.cpp
diff options
authorHarald Fernengel <>2011-07-07 15:31:19 +0200
committerQt by Nokia <>2011-07-07 16:10:50 +0200
commitf96a19d1b474292940dab3a20194a88395aca8ed (patch)
tree68952e1c5ae59b80dd9d4c239ced062b3a61ef3b /src/dbus/qdbus_symbols.cpp
parentf4c07fe72168778cd6ea5a6c07fb6add91b2e3d0 (diff)
Fix a crash when D-Bus library can't be loaded
In certain sandboxes, we have libQtDBus, but not D-Bus. QtDBus shouldn't crash in that case, but return non-working QDBusConnection instances instead. Change-Id: Ia4ac78d1197bae50cde0cf07e6fc66fc25b85011 Reviewed-on: Reviewed-by: Qt Sanity Bot <> Reviewed-by: Robert Griebl <>
Diffstat (limited to 'src/dbus/qdbus_symbols.cpp')
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dbus/qdbus_symbols.cpp b/src/dbus/qdbus_symbols.cpp
index 44597c39b6..fed18350bb 100644
--- a/src/dbus/qdbus_symbols.cpp
+++ b/src/dbus/qdbus_symbols.cpp
@@ -62,6 +62,12 @@ void qdbus_unloadLibDBus()
bool qdbus_loadLibDBus()
+ // this is to simulate a library load failure for our autotest suite.
+ if (!qgetenv("QT_SIMULATE_DBUS_LIBFAIL").isEmpty())
+ return false;
static volatile bool triedToLoadLibrary = false;
#ifndef QT_NO_THREAD
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&qdbus_resolve_me));