From 8fe61d79d6d629958da7e590174a0e0600652bed Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 Nov 2020 13:13:18 +0100 Subject: Fix leaked subsurface wayland items Whenever a subsurface was added we would create a QWaylandQuickItem, but this was never deleted. It is one-to-one with the surface, so it should be deleted at the same time. [ChangeLog][QtWaylandCompositor] Fixed a memory leak when creating subsurfaces. Task-number: QTBUG-88782 Change-Id: If4b3f15200ce3bd123ff73847d3593d174a39229 Reviewed-by: Paul Olav Tvete (cherry picked from commit 38fc568b30bf916165324c2cd2db127d2a9aa68c) Reviewed-by: Qt Cherry-pick Bot --- src/compositor/compositor_api/qwaylandquickitem.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 5010247f9..16b628c57 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -724,6 +724,7 @@ void QWaylandQuickItem::handleSubsurfaceAdded(QWaylandSurface *childSurface) childItem->setVisible(true); childItem->setParentItem(this); connect(childSurface, &QWaylandSurface::subsurfacePositionChanged, childItem, &QWaylandQuickItem::handleSubsurfacePosition); + connect(childSurface, &QWaylandSurface::destroyed, childItem, &QObject::deleteLater); } else { bool success = QMetaObject::invokeMethod(d->subsurfaceHandler, "handleSubsurfaceAdded", Q_ARG(QWaylandSurface *, childSurface)); if (!success) -- cgit v1.2.3