Wayland backend: Don't crash when terminating

Remember to release all resources before the wayland socket goes:
- release the seat as we give up a seat
- release the ssdManager
- release the output decoration with the output itself
Otherwise they leak and stay dangling.
This commit is contained in:
Aleix Pol Gonzalez 2022-09-15 16:43:04 +00:00
parent d7cba6b625
commit fdf2011b34

View file

@ -485,6 +485,7 @@ WaylandSeat::~WaylandSeat()
destroyPointerDevice(); destroyPointerDevice();
destroyKeyboardDevice(); destroyKeyboardDevice();
destroyTouchDevice(); destroyTouchDevice();
m_seat->release();
} }
void WaylandSeat::createPointerDevice() void WaylandSeat::createPointerDevice()
@ -578,6 +579,13 @@ WaylandBackend::~WaylandBackend()
eglTerminate(sceneEglDisplay()); eglTerminate(sceneEglDisplay());
} }
if (m_relativePointerManager) {
m_relativePointerManager->release();
}
if (m_ssdManager) {
m_ssdManager->release();
}
if (m_pointerGestures) { if (m_pointerGestures) {
m_pointerGestures->release(); m_pointerGestures->release();
} }
@ -768,7 +776,7 @@ WaylandOutput *WaylandBackend::createOutput(const QString &name, const QSize &si
} }
if (ssdManager()) { if (ssdManager()) {
auto decoration = ssdManager()->create(surface.get(), this); auto decoration = ssdManager()->create(surface.get(), surface.get());
connect(decoration, &ServerSideDecoration::modeChanged, this, [decoration] { connect(decoration, &ServerSideDecoration::modeChanged, this, [decoration] {
if (decoration->mode() != ServerSideDecoration::Mode::Server) { if (decoration->mode() != ServerSideDecoration::Mode::Server) {
decoration->requestMode(ServerSideDecoration::Mode::Server); decoration->requestMode(ServerSideDecoration::Mode::Server);