diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-03-21 12:25:39 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-03-23 10:15:44 +0000 |
commit | 4ad9b883e6db3af33ccbc87326cd162827af1393 (patch) | |
tree | e7570f77cde0e6c7481a246f774bd7ea084ff85f /src/compositor/extensions/qwaylandxdgshellv5integration.cpp | |
parent | 53c1cbcdae80f7036f0d1b8bd8dffbdc70ff3a9e (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/qwaylandxdgshellv5integration.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5integration.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp index e2aa6b3ea..156d5679b 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp @@ -65,6 +65,11 @@ XdgShellV5Integration::XdgShellV5Integration(QWaylandQuickShellSurfaceItem *item connect(m_xdgSurface->surface(), &QWaylandSurface::sizeChanged, this, &XdgShellV5Integration::handleSurfaceSizeChanged); } +XdgShellV5Integration::~XdgShellV5Integration() +{ + m_item->setSurface(nullptr); +} + bool XdgShellV5Integration::mouseMoveEvent(QMouseEvent *event) { if (grabberState == GrabberState::Resize) { @@ -190,6 +195,7 @@ void XdgShellV5Integration::handleSurfaceSizeChanged() XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item) : QWaylandQuickShellIntegration (item) + , m_item(item) , m_xdgPopup(qobject_cast<QWaylandXdgPopupV5 *>(item->shellSurface())) , m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell) { @@ -206,6 +212,11 @@ XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed); } +XdgPopupV5Integration::~XdgPopupV5Integration() +{ + m_item->setSurface(nullptr); +} + void XdgPopupV5Integration::handlePopupDestroyed() { QWaylandXdgShellV5Private *shellPrivate = QWaylandXdgShellV5Private::get(m_xdgShell); |