diff --git a/src/windowsystem/waylandintegration.cpp b/src/windowsystem/waylandintegration.cpp --- a/src/windowsystem/waylandintegration.cpp +++ b/src/windowsystem/waylandintegration.cpp @@ -26,14 +26,17 @@ #include #include #include +#include #include #include #include #include #include #include +#include + class WaylandIntegrationSingleton { public: @@ -63,6 +66,33 @@ m_registry->create(m_waylandConnection); m_waylandCompositor = Compositor::fromApplication(this); + //when the Qt QPA closes it deletes the wl_display + //closing wl_display deletes the wl_registry + //when we destroy the kwayland wrapper we double delete + //as we're a singleton we're not deleted till after qApp + //we want to release our wayland parts first + connect(qApp, &QCoreApplication::aboutToQuit, this, [=]() { + if (m_waylandBlurManager) { + m_waylandBlurManager->release(); + } + if (m_waylandContrastManager) { + m_waylandContrastManager->release(); + } + if (m_waylandSlideManager) { + m_waylandSlideManager->release(); + } + if (m_waylandCompositor) { + m_waylandCompositor->release(); + } + if (m_wm) { + m_wm->release(); + } + if (m_waylandPlasmaShell) { + m_waylandPlasmaShell->release(); + } + m_registry->release(); + }); + m_registry->setup(); m_waylandConnection->roundtrip(); }