diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2016-11-16 14:45:43 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2016-11-17 11:05:11 +0000 |
commit | a8a7e28708a5c0741c013247cd3f3dc985d0fb57 (patch) | |
tree | fe946b03db5e0e7242a959eda82d8a4a2e20b803 /src/compositor/extensions/qwaylandxdgshellv5integration.cpp | |
parent | 5994c093e430161155d77be3af1ab4128a3fb54e (diff) |
Fix crash with nested xdg popups
Popups that are children of popups would get a null parent in pure-qml.
This would cause a crash in XdgPopupV5Integration.
This change fixes pure-qml to set the parent correctly, and also adds
null pointer checks to XdgPopupV5Integration.
Change-Id: Ica5bd6c1a0853fbec1b30bc6ffff806b2cfd15f8
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/compositor/extensions/qwaylandxdgshellv5integration.cpp')
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5integration.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp index b3170333f..e2aa6b3ea 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp @@ -194,10 +194,14 @@ XdgPopupV5Integration::XdgPopupV5Integration(QWaylandQuickShellSurfaceItem *item , m_xdgShell(QWaylandXdgPopupV5Private::get(m_xdgPopup)->m_xdgShell) { item->setSurface(m_xdgPopup->surface()); - item->moveItem()->setPosition(QPointF(m_xdgPopup->position() * item->view()->output()->scaleFactor())); + if (item->view()->output()) + item->moveItem()->setPosition(QPointF(m_xdgPopup->position() * item->view()->output()->scaleFactor())); + else + qWarning() << "XdgPopupV5Integration popup item without output" << item; QWaylandClient *client = m_xdgPopup->surface()->client(); - QWaylandQuickShellEventFilter::startFilter(client, [&]() { m_xdgShell->closeAllPopups(); }); + auto shell = m_xdgShell; + QWaylandQuickShellEventFilter::startFilter(client, [shell]() { shell->closeAllPopups(); }); connect(m_xdgPopup, &QWaylandXdgPopupV5::destroyed, this, &XdgPopupV5Integration::handlePopupDestroyed); } |