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>
This commit is contained in:
Johan Klokkhammer Helsing 2019-11-01 11:24:26 +01:00 committed by Johan Helsing
parent 027f48b7d9
commit 8d409b0952
2 changed files with 8 additions and 3 deletions

View File

@ -109,6 +109,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());
}

View File

@ -124,9 +124,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);