summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2019-11-01 11:24:26 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-11-05 12:18:10 +0000
commit8676fb35b3efed69d39d17070e78bc93055939ee (patch)
tree00d5cf8fc7ee3ebedd433aa7f79dcec840aeb7ef
parente049a82502d363d8cc9764188ca726ce9d1b62e5 (diff)
Client: Fix crash when showing a child window with a hidden parent
[ChangeLog][QPA plugin] Fixed a crash when showing a window with a hidden parent. Now we just avoid creating the subsurface, so nothing is shown. Seems to be the same behavior as on xcb. Fixes: QTBUG-79674 Change-Id: Ia46fcd9a0da5aad4704816a41515cb1e128ac65f Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> (cherry picked from commit 962b9be7992cef672cb6307af5653c97382c334f)
-rw-r--r--src/client/qwaylanddisplay.cpp4
-rw-r--r--src/client/qwaylandwindow.cpp7
2 files changed, 8 insertions, 3 deletions
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 47b107e80..14469fe6d 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -107,6 +107,10 @@ struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
return nullptr;
}
+ // Make sure we don't pass NULL surfaces to libwayland (crashes)
+ Q_ASSERT(parent->object());
+ Q_ASSERT(window->object());
+
return mSubCompositor->get_subsurface(window->object(), parent->object());
}
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 109110aef..9e63fa17a 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -135,9 +135,10 @@ void QWaylandWindow::initWindow()
if (shouldCreateSubSurface()) {
Q_ASSERT(!mSubSurfaceWindow);
- QWaylandWindow *p = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
- if (::wl_subsurface *ss = mDisplay->createSubSurface(this, p)) {
- mSubSurfaceWindow = new QWaylandSubSurface(this, p, ss);
+ auto *parent = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
+ if (parent->object()) {
+ if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
+ mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
}
} else if (shouldCreateShellSurface()) {
Q_ASSERT(!mShellSurface);