summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandxdgshellv6.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-03-19 10:21:47 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-03-27 12:29:07 +0000
commit646d8d27552e548f37b329f3a67fd4bf46ee64f0 (patch)
tree22381f017c2890be51178a291c99cfffee85e346 /src/client/qwaylandxdgshellv6.cpp
parent83b67f717fe8ab5e95d9ca6e93cc139c8e0bd6c0 (diff)
xdg-shell v5,v6 shell integrations: Fix crash when showing popups
If a popup was shown without any input events happening first, it would cause nullptr dereferences in both xdg-shell v5 and v6. Fixes crashes in: - tst_QAccessibility::comboBoxTest - tst_QAccessibility::menuTest - tst_QWindow::touchInterruptedByPopup - tst_QFocusEvent::checkReason_Popup Task-number: QTBUG-67150 Change-Id: Ib3e06326f71e4ab5f74727cb4f79626a21c34d55 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 26a6372bb0c6528358e34f8175a14ff0be47fb12) Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/client/qwaylandxdgshellv6.cpp')
-rw-r--r--src/client/qwaylandxdgshellv6.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/qwaylandxdgshellv6.cpp b/src/client/qwaylandxdgshellv6.cpp
index 7473174d1..a8c253b8f 100644
--- a/src/client/qwaylandxdgshellv6.cpp
+++ b/src/client/qwaylandxdgshellv6.cpp
@@ -165,8 +165,9 @@ void QWaylandXdgSurfaceV6::setAppId(const QString &appId)
void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent)
{
- if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent) {
- setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial(), type == Qt::Popup);
+ QWaylandDisplay *display = m_window->display();
+ if ((type == Qt::Popup || type == Qt::ToolTip) && transientParent && display->lastInputDevice()) {
+ setPopup(transientParent, display->lastInputDevice(), display->lastInputSerial(), type == Qt::Popup);
} else {
setToplevel();
if (transientParent) {