diff --git a/plugins/qpa/integration.cpp b/plugins/qpa/integration.cpp
index abcd3e8434..9cb4482959 100644
--- a/plugins/qpa/integration.cpp
+++ b/plugins/qpa/integration.cpp
@@ -34,6 +34,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
#include
@@ -112,8 +113,8 @@ QPlatformWindow *Integration::createPlatformWindow(QWindow *window) const
return new QPlatformWindow(window);
} else {
// don't set window as parent, cause infinite recursion in PlasmaQuick::Dialog
- auto surface = c->createSurface();
- return new Window(window, surface, s->createSurface(surface), this);
+ auto surface = c->createSurface(c);
+ return new Window(window, surface, s->createSurface(surface, surface), this);
}
}
@@ -196,7 +197,7 @@ KWayland::Client::Compositor *Integration::compositor() const
auto registry = waylandServer()->internalClientRegistry();
const auto c = registry->interface(Registry::Interface::Compositor);
if (c.name != 0u) {
- const_cast(this)->m_compositor = registry->createCompositor(c.name, c.version);
+ const_cast(this)->m_compositor = registry->createCompositor(c.name, c.version, registry);
}
}
return m_compositor;
@@ -209,7 +210,7 @@ KWayland::Client::Shell *Integration::shell() const
auto registry = waylandServer()->internalClientRegistry();
const auto s = registry->interface(Registry::Interface::Shell);
if (s.name != 0u) {
- const_cast(this)->m_shell = registry->createShell(s.name, s.version);
+ const_cast(this)->m_shell = registry->createShell(s.name, s.version, registry);
}
}
return m_shell;
diff --git a/plugins/qpa/window.cpp b/plugins/qpa/window.cpp
index 43a3297be2..7efc95cee2 100644
--- a/plugins/qpa/window.cpp
+++ b/plugins/qpa/window.cpp
@@ -43,6 +43,8 @@ Window::Window(QWindow *window, KWayland::Client::Surface *surface, KWayland::Cl
, m_windowId(++s_windowId)
, m_integration(integration)
{
+ QObject::connect(m_surface, &QObject::destroyed, window, [this] { m_surface = nullptr;});
+ QObject::connect(m_shellSurface, &QObject::destroyed, window, [this] { m_shellSurface = nullptr;});
waylandServer()->internalClientConection()->flush();
}
@@ -103,8 +105,10 @@ void Window::unmap()
if (m_shellClient) {
m_shellClient->setInternalFramebufferObject(QSharedPointer());
}
- m_surface->attachBuffer(KWayland::Client::Buffer::Ptr());
- m_surface->commit(KWayland::Client::Surface::CommitFlag::None);
+ if (m_surface) {
+ m_surface->attachBuffer(KWayland::Client::Buffer::Ptr());
+ m_surface->commit(KWayland::Client::Surface::CommitFlag::None);
+ }
if (waylandServer()->internalClientConection()) {
waylandServer()->internalClientConection()->flush();
}
diff --git a/wayland_server.cpp b/wayland_server.cpp
index f44726c124..f1b59b0d5c 100644
--- a/wayland_server.cpp
+++ b/wayland_server.cpp
@@ -29,6 +29,7 @@ along with this program. If not, see .
#include
#include
#include
+#include
#include
// Server
#include
@@ -75,6 +76,8 @@ WaylandServer::~WaylandServer() = default;
void WaylandServer::destroyInternalConnection()
{
if (m_internalConnection.client) {
+ delete m_internalConnection.registry;
+ delete m_internalConnection.shm;
dispatch();
m_internalConnection.client->deleteLater();
m_internalConnection.clientThread->quit();