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
This commit is contained in:
Xaver Hugl 2024-06-18 16:07:00 +02:00
parent b107295c03
commit 92f1fabe5b

View file

@ -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<SeatInterface *> 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();