Fix crash when opening a window with a hidden parent

We have a transient parent but it doesn't have a shell surface.
We need to make sure that it exists before setting the transient
parent's shell surface as the parent to the window.

Change-Id: I918b2f14074217638529ba73530f0102f7438079
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
This commit is contained in:
Aleix Pol 2017-10-13 15:44:09 +02:00 committed by Paul Olav Tvete
parent 5e6e5d8930
commit 0f29ae0024

View File

@ -169,7 +169,8 @@ void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transien
setToplevel();
if (transientParent) {
auto parentXdgSurface = static_cast<QWaylandXdgSurfaceV6 *>(transientParent->shellSurface());
m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
if (parentXdgSurface)
m_toplevel->set_parent(parentXdgSurface->m_toplevel->object());
}
}
}