From c7c0152776f2358dd8dc4c6f21c2853d4c14bbe2 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 11 Apr 2013 00:14:12 -0700 Subject: KDE: avoid creating a shared session D-Bus connection before creating the app Qt has never been happy with the old code, reporting: QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave. This error message became visible again after some recent logging changes and broke tests, so better avoid it by testing for D-Bus with a private connection. --- src/backends/kde/KDEPlatform.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backends/kde/KDEPlatform.cpp b/src/backends/kde/KDEPlatform.cpp index 1b98ccdc..c10eb689 100644 --- a/src/backends/kde/KDEPlatform.cpp +++ b/src/backends/kde/KDEPlatform.cpp @@ -52,8 +52,14 @@ void KDEInitMainSlot(const char *appname) { // Very simple check. API doesn't say whether asking // for the bus connection will connect immediately. - QDBusConnection dbus = QDBusConnection::sessionBus(); - HaveDBus = dbus.isConnected(); + // We use a private connection here instead of the shared + // QDBusConnection::sessionBus() because we don't have + // a QCoreApplication yet. Otherwise we get a warning: + // "QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave." + { + QDBusConnection dbus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "org.syncevolution.kde-platform-test-connection"); + HaveDBus = dbus.isConnected(); + } if (!HaveDBus) { // KApplication has been seen to crash without D-Bus (BMC #25596). -- cgit v1.2.3