summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel d'Andrada <daniel.dandrada@luxoft.com>2018-05-29 12:56:51 +0200
committerDaniel d'Andrada <daniel.dandrada@luxoft.com>2018-05-29 12:01:27 +0000
commit01c566aa88eb6debd96390e1968fb18d92367a37 (patch)
tree267e249db9bbd1bd49135065c0ff3c2d52c05988
parent2b67dd2fc61331335cb3d80d15c07692bc1631b3 (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.cpp9
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;
}
/*!