Ensure internal Wayland connection is properly setup before creating LockScreen integration
With the new Wayland only mode we start too fast and it can happen that the initWithWorkspace is called before the client connection is fully setup. This would result in a crash in the idletime plugin once it tries to create a seat. To prevent this problem the code is split out into a dedicated method and only invoked if all interfaces have been announced on the internal connection. BUG: 385397 FIXED-IN: 5.11.1
This commit is contained in:
parent
c27f6dcde1
commit
31b5b7f9f9
2 changed files with 37 additions and 19 deletions
|
@ -330,6 +330,18 @@ void WaylandServer::initWorkspace()
|
|||
}
|
||||
|
||||
if (hasScreenLockerIntegration()) {
|
||||
if (m_internalConnection.interfacesAnnounced) {
|
||||
initScreenLocker();
|
||||
} else {
|
||||
connect(m_internalConnection.registry, &KWayland::Client::Registry::interfacesAnnounced, this, &WaylandServer::initScreenLocker);
|
||||
}
|
||||
} else {
|
||||
emit initialized();
|
||||
}
|
||||
}
|
||||
|
||||
void WaylandServer::initScreenLocker()
|
||||
{
|
||||
ScreenLocker::KSldApp::self();
|
||||
ScreenLocker::KSldApp::self()->setWaylandDisplay(m_display);
|
||||
ScreenLocker::KSldApp::self()->setGreeterEnvironment(kwinApp()->processStartupEnvironment());
|
||||
|
@ -350,7 +362,6 @@ void WaylandServer::initWorkspace()
|
|||
if (m_initFlags.testFlag(InitalizationFlag::LockScreen)) {
|
||||
ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate);
|
||||
}
|
||||
}
|
||||
emit initialized();
|
||||
}
|
||||
|
||||
|
@ -521,6 +532,11 @@ void WaylandServer::createInternalConnection()
|
|||
m_internalConnection.shm = m_internalConnection.registry->createShmPool(name, version, this);
|
||||
}
|
||||
);
|
||||
connect(registry, &Registry::interfacesAnnounced, this,
|
||||
[this] {
|
||||
m_internalConnection.interfacesAnnounced = true;
|
||||
}
|
||||
);
|
||||
registry->setup();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -200,6 +200,7 @@ private:
|
|||
void configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *config);
|
||||
template <class T>
|
||||
void createSurface(T *surface);
|
||||
void initScreenLocker();
|
||||
KWayland::Server::Display *m_display = nullptr;
|
||||
KWayland::Server::CompositorInterface *m_compositor = nullptr;
|
||||
KWayland::Server::SeatInterface *m_seat = nullptr;
|
||||
|
@ -222,6 +223,7 @@ private:
|
|||
QThread *clientThread = nullptr;
|
||||
KWayland::Client::Registry *registry = nullptr;
|
||||
KWayland::Client::ShmPool *shm = nullptr;
|
||||
bool interfacesAnnounced = false;
|
||||
|
||||
} m_internalConnection;
|
||||
struct {
|
||||
|
|
Loading…
Reference in a new issue