diff options
author | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-05-29 12:56:51 +0200 |
---|---|---|
committer | Daniel d'Andrada <daniel.dandrada@luxoft.com> | 2018-05-29 12:01:27 +0000 |
commit | 01c566aa88eb6debd96390e1968fb18d92367a37 (patch) | |
tree | 267e249db9bbd1bd49135065c0ff3c2d52c05988 | |
parent | 2b67dd2fc61331335cb3d80d15c07692bc1631b3 (diff) |
QWaylandView: Don't crash on [set|is]Primary when no surface around
Change-Id: Ic13d773da854aa5025222d3896f824deea0df279
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r-- | src/compositor/compositor_api/qwaylandview.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 4d6f392e1..477b45897 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -350,12 +350,17 @@ void QWaylandView::setAllowDiscardFrontBuffer(bool discard) /*! * Makes this QWaylandView the primary view for the surface. * + * It has no effect if this QWaylandView is not holding any QWaylandSurface + * * \sa QWaylandSurface::primaryView */ void QWaylandView::setPrimary() { Q_D(QWaylandView); - d->surface->setPrimaryView(this); + if (d->surface) + d->surface->setPrimaryView(this); + else + qWarning("Calling setPrimary() on a QWaylandView without a surface has no effect."); } /*! @@ -366,7 +371,7 @@ void QWaylandView::setPrimary() bool QWaylandView::isPrimary() const { Q_D(const QWaylandView); - return d->surface->primaryView() == this; + return d->surface && d->surface->primaryView() == this; } /*! |