summaryrefslogtreecommitdiffstats
path: root/src/window-lib
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2022-03-08 18:44:11 +0100
committerRobert Griebl <robert.griebl@qt.io>2022-03-21 16:42:06 +0000
commit969864e00491d262cdaf167a8d72ea5b0538bc7d (patch)
treed8ca2926aecc9e32e36ee299b6fd9973fb536c7b /src/window-lib
parent9e6df5575b993c50ab99bada2885f6af5c5884ff (diff)
Fix memory leaks introduced by adding the PackageInfo mechanism
Found by the Linux/gcc/ASAN leak checker. Change-Id: I3c85515b994ad21b8718349baa81f9fc52a20615 Pick-to: 6.3 6.3.0 6.2 6.2.4 5.15 Reviewed-by: Bernd Weimer <bernd.weimer@qt.io>
Diffstat (limited to 'src/window-lib')
-rw-r--r--src/window-lib/waylandcompositor.cpp12
-rw-r--r--src/window-lib/waylandcompositor.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/window-lib/waylandcompositor.cpp b/src/window-lib/waylandcompositor.cpp
index 24a487fa..540fd048 100644
--- a/src/window-lib/waylandcompositor.cpp
+++ b/src/window-lib/waylandcompositor.cpp
@@ -154,6 +154,11 @@ WaylandCompositor::WaylandCompositor(QQuickWindow *window, const QString &waylan
, m_amExtension(new WaylandQtAMServerExtension(this))
, m_textInputManager(new QWaylandTextInputManager(this))
{
+ m_wlShell->setParent(this);
+ m_xdgShell->setParent(this);
+ m_amExtension->setParent(this);
+ m_textInputManager->setParent(this);
+
setSocketName(waylandSocketName.toUtf8());
registerOutputWindow(window);
@@ -178,6 +183,13 @@ WaylandCompositor::WaylandCompositor(QQuickWindow *window, const QString &waylan
defaultSeat()->keymap()->setLayout(QLocale::system().name().section(qL1C('_'), 1, 1).toLower());
}
+WaylandCompositor::~WaylandCompositor()
+{
+ // QWayland leaks like sieve everywhere, but we need this explicit delete to be able
+ // to suppress the rest via LSAN leak suppression files
+ delete defaultSeat();
+}
+
void WaylandCompositor::xdgPing(WindowSurface* surface)
{
uint serial = m_xdgShell->ping(surface->client());
diff --git a/src/window-lib/waylandcompositor.h b/src/window-lib/waylandcompositor.h
index 0ada3af0..d97f8cae 100644
--- a/src/window-lib/waylandcompositor.h
+++ b/src/window-lib/waylandcompositor.h
@@ -117,6 +117,8 @@ class WaylandCompositor : public QWaylandQuickCompositor // clazy:exclude=missin
Q_OBJECT
public:
WaylandCompositor(QQuickWindow* window, const QString &waylandSocketName);
+ ~WaylandCompositor() override;
+
void registerOutputWindow(QQuickWindow *window);
WaylandQtAMServerExtension *amExtension();