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
wilder-5.19
Kai Uwe Broulik 7 years ago
parent 71dbe70d2c
commit 0133391337
  1. 9
      libnotificationmanager/jobsmodel_p.cpp

@ -32,6 +32,8 @@
#include "jobviewserverv2adaptor.h"
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusMessage>
#include <QDBusServiceWatcher>
#include <KJob>
@ -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();
}

Loading…
Cancel
Save