From 6f8d606b90af2bb582b90c400dce9dcc09edd295 Mon Sep 17 00:00:00 2001 From: Raine Makelainen Date: Mon, 19 Jun 2017 16:37:16 +0300 Subject: [PATCH] Cleanup dbus interface destructions --- .../declarativeconnectionagent.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/connectionagentplugin/declarativeconnectionagent.cpp b/connectionagentplugin/declarativeconnectionagent.cpp index 6ec7de6..0b92043 100644 --- a/connectionagentplugin/declarativeconnectionagent.cpp +++ b/connectionagentplugin/declarativeconnectionagent.cpp @@ -28,7 +28,7 @@ DeclarativeConnectionAgent::DeclarativeConnectionAgent(QObject *parent): QObject(parent), - connManagerInterface(0) + connManagerInterface(nullptr) { connectiondWatcher = new QDBusServiceWatcher(CONND_SERVICE,QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration | @@ -48,10 +48,8 @@ DeclarativeConnectionAgent::~DeclarativeConnectionAgent() void DeclarativeConnectionAgent::connectToConnectiond(QString) { - if (connManagerInterface) { - delete connManagerInterface; - connManagerInterface = 0; - } + delete connManagerInterface; + connManagerInterface = nullptr; if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE)) { qDebug() << Q_FUNC_INFO << QString("connection service not available").arg(CONND_SERVICE); @@ -143,10 +141,8 @@ void DeclarativeConnectionAgent::onUserInputRequested(const QString &service, co void DeclarativeConnectionAgent::connectiondUnregistered(QString) { - if (connManagerInterface) { - delete connManagerInterface; - connManagerInterface = 0; - } + delete connManagerInterface; + connManagerInterface = nullptr; } void DeclarativeConnectionAgent::startTethering(const QString &type)