Commit 6f51b766 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Don't crash ksmserver if restoreSession is called twice

The connection to the lambda persists, so when it's called a second time,
the lambda is also called twice, eventually resulting in a nullptr deref as
m_restoreSessionCall is empty.
parent dbc1d472
......@@ -694,6 +694,11 @@ KSMServer::KSMServer(InitFlags flags)
connect(&protectionTimer, &QTimer::timeout, this, &KSMServer::protectionTimeout);
connect(&restoreTimer, &QTimer::timeout, this, &KSMServer::tryRestoreNext);
connect(this, &KSMServer::sessionRestored, this, [this]() {
auto reply = m_restoreSessionCall.createReply();
QDBusConnection::sessionBus().send(reply);
m_restoreSessionCall = QDBusMessage();
});
connect(qApp, &QApplication::aboutToQuit, this, &KSMServer::cleanUp);
setupXIOErrorHandler();
......@@ -1029,11 +1034,6 @@ void KSMServer::restoreSession()
lastAppStarted = 0;
lastIdStarted.clear();
state = KSMServer::Restoring;
connect(this, &KSMServer::sessionRestored, this, [this]() {
auto reply = m_restoreSessionCall.createReply();
QDBusConnection::sessionBus().send(reply);
m_restoreSessionCall = QDBusMessage();
});
tryRestoreNext();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment