ContainmentInterface: Move to lambda to a private slot

The containment interface deletion order isn't clear. It can happen that
it is deleted before the application quits, and then this lambda is
called, and its accesses internals of the class even though it has been
deleted.

Reviewd-By: Marco Martin
This commit is contained in:
Vishesh Handa 2015-06-19 01:06:59 +02:00
parent c77377221b
commit 2dbeea4d23
2 changed files with 11 additions and 7 deletions

View File

@ -73,13 +73,16 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, cons
}
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
[=]() {
if (!m_containment) {
return;
}
disconnect(m_containment.data(), &Plasma::Containment::appletRemoved,
this, &ContainmentInterface::appletRemovedForward);
});
this, &ContainmentInterface::slotAboutToQuit);
}
void ContainmentInterface::slotAboutToQuit()
{
if (!m_containment) {
return;
}
disconnect(m_containment.data(), &Plasma::Containment::appletRemoved,
this, &ContainmentInterface::appletRemovedForward);
}
void ContainmentInterface::init()

View File

@ -205,6 +205,7 @@ protected Q_SLOTS:
private Q_SLOTS:
Plasma::Applet *createApplet(const QString &plugin, const QVariantList &args, const QPoint &pos);
void slotAboutToQuit();
private:
void clearDataForMimeJob(KIO::Job *job);