From 26c44a65242941de2fd313c22514741f4195d2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 27 Mar 2015 14:16:55 +0100 Subject: [PATCH] Add recursion check to LogindIntegration::takeControl We never want to call takeControl twice at the same time. --- logind.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/logind.cpp b/logind.cpp index a04a6d79f4..9596c739c1 100644 --- a/logind.cpp +++ b/logind.cpp @@ -175,6 +175,11 @@ void LogindIntegration::takeControl() if (!m_connected || m_sessionPath.isEmpty() || m_sessionControl) { return; } + static bool s_recursionCheck = false; + if (s_recursionCheck) { + return; + } + s_recursionCheck = true; QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service, m_sessionPath, @@ -185,6 +190,7 @@ void LogindIntegration::takeControl() QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(session, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *self) { + s_recursionCheck = false; QDBusPendingReply reply = *self; self->deleteLater(); if (!reply.isValid()) {