QCoreApplication::closingDown() becomes true too late

restore the disconnect: sometimes appletRemovedForward gets executed after
aboutToQuit is emitted, but before closingDown returns true
this prevents configuration to be forgotten
This commit is contained in:
Marco Martin 2014-07-08 12:49:04 +02:00
parent a5ecb2e0ff
commit 9218543b65

View File

@ -90,6 +90,15 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent, cons
if (!m_appletInterfaces.isEmpty()) { if (!m_appletInterfaces.isEmpty()) {
emit appletsChanged(); emit appletsChanged();
} }
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
[=]() {
if (!m_containment) {
return;
}
disconnect(m_containment.data(), &Plasma::Containment::appletRemoved,
this, &ContainmentInterface::appletRemovedForward);
});
} }
void ContainmentInterface::init() void ContainmentInterface::init()
@ -574,10 +583,6 @@ void ContainmentInterface::appletAddedForward(Plasma::Applet *applet)
void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet)
{ {
if (QCoreApplication::closingDown()) {
return;
}
QObject *appletGraphicObject = applet->property("_plasma_graphicObject").value<QObject *>(); QObject *appletGraphicObject = applet->property("_plasma_graphicObject").value<QObject *>();
m_appletInterfaces.removeAll(appletGraphicObject); m_appletInterfaces.removeAll(appletGraphicObject);
emit appletRemoved(appletGraphicObject); emit appletRemoved(appletGraphicObject);