mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: do not use global static for the notifications applet adaptors
because the adaptors are parented to the application instance for object registration purpose the global static deleter double-deletes them Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f1eb5815cb
commit
3b86c8487a
4 changed files with 20 additions and 2 deletions
|
@ -23,7 +23,7 @@
|
|||
#include <QDBusConnection>
|
||||
#include <KGlobal>
|
||||
|
||||
K_GLOBAL_STATIC_WITH_ARGS(JobTrackerAdaptor, kJobTrackerAdaptor, (qApp))
|
||||
static JobTrackerAdaptor* kJobTrackerAdaptor = nullptr;
|
||||
|
||||
JobTrackerAdaptor::JobTrackerAdaptor(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
|
@ -31,6 +31,11 @@ JobTrackerAdaptor::JobTrackerAdaptor(QObject *parent)
|
|||
{
|
||||
}
|
||||
|
||||
JobTrackerAdaptor::~JobTrackerAdaptor()
|
||||
{
|
||||
Q_ASSERT(m_ref == 0);
|
||||
}
|
||||
|
||||
void JobTrackerAdaptor::addJob(const QString &name)
|
||||
{
|
||||
emit jobAdded(name);
|
||||
|
@ -48,6 +53,9 @@ void JobTrackerAdaptor::stopJob(const QString &name)
|
|||
|
||||
JobTrackerAdaptor* JobTrackerAdaptor::self()
|
||||
{
|
||||
if (!kJobTrackerAdaptor) {
|
||||
kJobTrackerAdaptor = new JobTrackerAdaptor(qApp);
|
||||
}
|
||||
return kJobTrackerAdaptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class JobTrackerAdaptor: public QDBusAbstractAdaptor
|
|||
Q_CLASSINFO("D-Bus Interface", "org.kde.JobTracker")
|
||||
public:
|
||||
JobTrackerAdaptor(QObject *parent);
|
||||
~JobTrackerAdaptor();
|
||||
|
||||
static JobTrackerAdaptor* self();
|
||||
void registerObject();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <QDBusConnection>
|
||||
#include <KGlobal>
|
||||
|
||||
K_GLOBAL_STATIC_WITH_ARGS(NotificationsAdaptor, kNotificationsAdaptor, (qApp))
|
||||
static NotificationsAdaptor* kNotificationsAdaptor = nullptr;
|
||||
|
||||
NotificationsAdaptor::NotificationsAdaptor(QObject *parent)
|
||||
: QDBusAbstractAdaptor(parent),
|
||||
|
@ -31,6 +31,11 @@ NotificationsAdaptor::NotificationsAdaptor(QObject *parent)
|
|||
{
|
||||
}
|
||||
|
||||
NotificationsAdaptor::~NotificationsAdaptor()
|
||||
{
|
||||
Q_ASSERT(m_ref == 0);
|
||||
}
|
||||
|
||||
void NotificationsAdaptor::addNotification(const QString &name)
|
||||
{
|
||||
emit notificationAdded(name);
|
||||
|
@ -53,6 +58,9 @@ void NotificationsAdaptor::invokeAction(const QString &name, const QString &acti
|
|||
|
||||
NotificationsAdaptor* NotificationsAdaptor::self()
|
||||
{
|
||||
if (!kNotificationsAdaptor) {
|
||||
kNotificationsAdaptor = new NotificationsAdaptor(qApp);
|
||||
}
|
||||
return kNotificationsAdaptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class NotificationsAdaptor: public QDBusAbstractAdaptor
|
|||
Q_CLASSINFO("D-Bus Interface", "org.kde.Notifications")
|
||||
public:
|
||||
NotificationsAdaptor(QObject *parent);
|
||||
~NotificationsAdaptor();
|
||||
|
||||
static NotificationsAdaptor* self();
|
||||
void registerObject();
|
||||
|
|
Loading…
Add table
Reference in a new issue