summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-03-21 12:25:39 +0100
committerJohan Helsing <johan.helsing@qt.io>2017-03-23 10:15:44 +0000
commit4ad9b883e6db3af33ccbc87326cd162827af1393 (patch)
treee7570f77cde0e6c7481a246f774bd7ea084ff85f /src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
parent53c1cbcdae80f7036f0d1b8bd8dffbdc70ff3a9e (diff)
Fix crash when assigning nullptr to ShellSurfaceItem.shellSurface
This also fixes a memory leak when switching shellSurfaces. Task-number: QTBUG-59591 Change-Id: I196ea7238d9139c8ac281f82bbae8dd066b1fcd7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Diffstat (limited to 'src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp')
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
index 91f9d7771..64d895613 100644
--- a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -112,7 +112,14 @@ void QWaylandQuickShellSurfaceItem::setShellSurface(QWaylandShellSurface *shellS
d->m_shellSurface = shellSurface;
- d->m_shellIntegration = shellSurface->createIntegration(this);
+ if (d->m_shellIntegration) {
+ delete d->m_shellIntegration;
+ d->m_shellIntegration = nullptr;
+ }
+
+ if (shellSurface)
+ d->m_shellIntegration = shellSurface->createIntegration(this);
+
emit shellSurfaceChanged();
}