summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-12-21 15:24:49 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-04-02 12:40:48 +0000
commitf602191778cce57a67fdeffe5f3cc0e1cd2c7b53 (patch)
tree4a9c064973c2e12d7306fb9370c56543ace8a50a /src/plugins
parent7a0956a89a559e5a73a659fcc08001cefa01d9bd (diff)
downloadqtwayland-f602191778cce57a67fdeffe5f3cc0e1cd2c7b53.tar.gz
Client xdg-shell v5: Fix crash when creating a popup without a valid parent
Fixes: QTBUG-72696 Change-Id: I43f0a02a4447238aa93142981d22597c452790fd Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp3
-rw-r--r--src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp13
2 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
index 4cbafbd7..3eda43d7 100644
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5.cpp
@@ -71,6 +71,9 @@ QWaylandXdgSurfaceV5 *QWaylandXdgShellV5::createXdgSurface(QWaylandWindow *windo
QWaylandXdgPopupV5 *QWaylandXdgShellV5::createXdgPopup(QWaylandWindow *window, QWaylandInputDevice *inputDevice)
{
QWaylandWindow *parentWindow = m_popups.empty() ? window->transientParent() : m_popups.last();
+ if (!parentWindow)
+ return nullptr;
+
::wl_surface *parentSurface = parentWindow->object();
if (m_popupSerial == 0)
diff --git a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
index 12cc95b1..410f2700 100644
--- a/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v5/qwaylandxdgshellv5integration.cpp
@@ -73,10 +73,15 @@ bool QWaylandXdgShellV5Integration::initialize(QWaylandDisplay *display)
QWaylandShellSurface *QWaylandXdgShellV5Integration::createShellSurface(QWaylandWindow *window)
{
QWaylandInputDevice *inputDevice = window->display()->lastInputDevice();
- if (window->window()->type() == Qt::WindowType::Popup && inputDevice)
- return m_xdgShell->createXdgPopup(window, inputDevice);
- else
- return m_xdgShell->createXdgSurface(window);
+ if (window->window()->type() == Qt::WindowType::Popup && inputDevice) {
+ if (auto *popup = m_xdgShell->createXdgPopup(window, inputDevice))
+ return popup;
+
+ qWarning(lcQpaWayland) << "Failed to create xdg-popup v5 for window" << window->window()
+ << "falling back to creating an xdg-surface";
+ }
+
+ return m_xdgShell->createXdgSurface(window);
}
void QWaylandXdgShellV5Integration::handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) {