diff --git a/src/util/externalcommandhelper.cpp b/src/util/externalcommandhelper.cpp index d542324..2b89c75 100644 --- a/src/util/externalcommandhelper.cpp +++ b/src/util/externalcommandhelper.cpp @@ -62,6 +62,7 @@ ActionReply ExternalCommandHelper::init(const QVariantMap& args) m_publicKey = QCA::PublicKey::fromDER(args[QStringLiteral("pubkey")].toByteArray()); + m_loop = std::make_unique(); HelperSupport::progressStep(QVariantMap()); auto timeout = [this] () { QDBusInterface iface(QStringLiteral("org.kde.kpmcore.applicationinterface"), @@ -74,7 +75,7 @@ ActionReply ExternalCommandHelper::init(const QVariantMap& args) auto exitLoop = [&] (QDBusPendingCallWatcher *watcher) { if (watcher->isError()) { qWarning() << watcher->error(); - m_loop.exit(); + m_loop->exit(); } }; connect(watcher, &QDBusPendingCallWatcher::finished, exitLoop); @@ -83,7 +84,7 @@ ActionReply ExternalCommandHelper::init(const QVariantMap& args) QTimer *timer = new QTimer(this); connect(timer, &QTimer::timeout, this, timeout); timer->start(5000); // 5 seconds - m_loop.exec(); + m_loop->exec(); reply.addData(QStringLiteral("success"), true); return reply; @@ -313,7 +314,7 @@ void ExternalCommandHelper::exit(const QByteArray& signature, const quint64 nonc return; } - m_loop.exit(); + m_loop->exit(); QDBusConnection::systemBus().unregisterObject(QStringLiteral("/Helper")); QDBusConnection::systemBus().unregisterService(QStringLiteral("org.kde.kpmcore.helperinterface")); diff --git a/src/util/externalcommandhelper.h b/src/util/externalcommandhelper.h index 4f1cab7..0ab9ef9 100644 --- a/src/util/externalcommandhelper.h +++ b/src/util/externalcommandhelper.h @@ -18,6 +18,7 @@ #ifndef KPMCORE_EXTERNALCOMMANDHELPER_H #define KPMCORE_EXTERNALCOMMANDHELPER_H +#include #include #include @@ -54,7 +55,7 @@ public Q_SLOTS: private: void onReadOutput(); - QEventLoop m_loop; + std::unique_ptr m_loop; QCA::Initializer initializer; QCA::PublicKey m_publicKey; QRandomGenerator64 m_Generator;