From 27b953efae3bbd02509d7d9d5c514cadf0e51d85 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 7 Jul 2011 17:02:42 +0200 Subject: [PATCH] Don't keep a static instance of QDBusConnection Prevents weird crashes at app exit and makes backtraces from potential crashes saner because they won't start in __cxa_init. Change-Id: I62821faad03b06ec92da05d96027b668d1f1ca0f Reviewed-on: http://codereview.qt.nokia.com/1324 Reviewed-by: Qt Sanity Bot Reviewed-by: Robert Griebl --- .../bearer/connman/qofonoservice_linux.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 7c0a255c17..d862456ddc 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -57,8 +57,6 @@ #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); - QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent) : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE), @@ -106,7 +104,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), QLatin1String(OFONO_MANAGER_PATH), QLatin1String(OFONO_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -256,7 +254,7 @@ void QOfonoModemInterface::connectNotify(const char *signal) QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_MODEM_INTERFACE), QLatin1String("PropertyChanged"), @@ -379,7 +377,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE), QLatin1String("PropertyChanged"), @@ -477,7 +475,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE), QLatin1String("PropertyChanged"), @@ -580,7 +578,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SIM_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -669,7 +667,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE), QLatin1String("PropertyChanged"), @@ -788,7 +786,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_DATA_CONTEXT_INTERFACE), QLatin1String("PropertyChanged"), @@ -870,7 +868,7 @@ void QOfonoSmsInterface::connectNotify(const char *signal) QOfonoDBusHelper *helper; helper = new QOfonoDBusHelper(this); - dbusConnection.connect(QLatin1String(OFONO_SERVICE), + QDBusConnection::systemBus().connect(QLatin1String(OFONO_SERVICE), this->path(), QLatin1String(OFONO_SMS_MANAGER_INTERFACE), QLatin1String("PropertyChanged"),