From 01333913374e0a381382c139a9000972add29346 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 13 May 2019 09:57:35 +0200 Subject: [PATCH] Check if service is still registered before showing progress Should Plasma be too busy to process a request and the app that requested it quit before Plasma processed it, we will get a defunct job view that cannot be canceled because the app that owned it isn't listening anymore. Differential Revision: https://phabricator.kde.org/D21180 --- libnotificationmanager/jobsmodel_p.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libnotificationmanager/jobsmodel_p.cpp b/libnotificationmanager/jobsmodel_p.cpp index fe41c574e..b1db074a3 100644 --- a/libnotificationmanager/jobsmodel_p.cpp +++ b/libnotificationmanager/jobsmodel_p.cpp @@ -32,6 +32,8 @@ #include "jobviewserverv2adaptor.h" #include +#include +#include #include #include @@ -343,6 +345,13 @@ QDBusObjectPath JobsModelPrivate::requestView(const QString &desktopEntry, m_jobServices.insert(job, serviceName); m_serviceWatcher->addWatchedService(serviceName); + if (!connection().interface()->isServiceRegistered(serviceName)) { + qCWarning(NOTIFICATIONMANAGER) << "Service that requested the view wasn't registered anymore by the time the request was being processed"; + QMetaObject::invokeMethod(this, [this, serviceName] { + onServiceUnregistered(serviceName); + }, Qt::QueuedConnection); + } + return job->d->objectPath(); }