From 92f1fabe5b4494087605e476bc270db82728875d Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 18 Jun 2024 16:07:00 +0200 Subject: [PATCH] wayland_server: create a new screen locker connection when the greeter gets restarted Otherwise, Wayland objects and protocol errors can cause the new instance to not start --- src/wayland_server.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/wayland_server.cpp b/src/wayland_server.cpp index d69d3fbadb..f9290b3799 100644 --- a/src/wayland_server.cpp +++ b/src/wayland_server.cpp @@ -625,16 +625,6 @@ void WaylandServer::initScreenLocker() ScreenLocker::KSldApp::self()->setGreeterEnvironment(kwinApp()->processStartupEnvironment()); connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::aboutToLock, this, [this, screenLockerApp]() { - if (m_screenLockerClientConnection) { - // Already sent data to KScreenLocker. - return; - } - int clientFd = createScreenLockerConnection(); - if (clientFd < 0) { - return; - } - ScreenLocker::KSldApp::self()->setWaylandFd(clientFd); - new LockScreenPresentationWatcher(this); const QList seatIfaces = m_display->seats(); @@ -644,6 +634,19 @@ void WaylandServer::initScreenLocker() } }); + connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::aboutToStartGreeter, this, [this]() { + if (m_screenLockerClientConnection) { + m_screenLockerClientConnection->destroy(); + delete m_screenLockerClientConnection; + m_screenLockerClientConnection = nullptr; + } + int clientFd = createScreenLockerConnection(); + if (clientFd < 0) { + return; + } + ScreenLocker::KSldApp::self()->setWaylandFd(clientFd); + }); + connect(ScreenLocker::KSldApp::self(), &ScreenLocker::KSldApp::unlocked, this, [this, screenLockerApp]() { if (m_screenLockerClientConnection) { m_screenLockerClientConnection->destroy();