summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2018-07-04 15:34:27 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2018-09-11 10:49:56 +0000
commit297bcd005c4205f69e1bf9e9dc565ab757cf0bac (patch)
tree57f0fe648822041bb755cdee8f7a985fcd6fe4e2
parent8bf3546cb1fc07849cec0c2b509882970cc78a9c (diff)
downloadqtwayland-297bcd005c4205f69e1bf9e9dc565ab757cf0bac.tar.gz
Don't destroy buffer before surfaceDestroyed signal
Give the application time to set buffer lock first. Change-Id: Id8a7ee8956bc587344b8eece7072edff5197414c Task-number: QTBUG-69384 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r--src/compositor/compositor_api/qwaylandview.cpp57
-rw-r--r--src/compositor/compositor_api/qwaylandview_p.h2
2 files changed, 35 insertions, 24 deletions
diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp
index 477b4589..12759377 100644
--- a/src/compositor/compositor_api/qwaylandview.cpp
+++ b/src/compositor/compositor_api/qwaylandview.cpp
@@ -55,8 +55,9 @@ void QWaylandViewPrivate::markSurfaceAsDestroyed(QWaylandSurface *surface)
Q_Q(QWaylandView);
Q_ASSERT(surface == this->surface);
- q->setSurface(nullptr);
+ setSurface(nullptr);
emit q->surfaceDestroyed();
+ clearFrontBuffer();
}
/*!
@@ -132,38 +133,46 @@ QWaylandSurface *QWaylandView::surface() const
return d->surface;
}
-void QWaylandView::setSurface(QWaylandSurface *newSurface)
-{
- Q_D(QWaylandView);
- if (d->surface == newSurface)
- return;
-
- if (d->surface) {
- QWaylandSurfacePrivate::get(d->surface)->derefView(this);
- if (d->output)
- QWaylandOutputPrivate::get(d->output)->removeView(this, d->surface);
+void QWaylandViewPrivate::setSurface(QWaylandSurface *newSurface)
+{
+ Q_Q(QWaylandView);
+ if (surface) {
+ QWaylandSurfacePrivate::get(surface)->derefView(q);
+ if (output)
+ QWaylandOutputPrivate::get(output)->removeView(q, surface);
}
- d->surface = newSurface;
+ surface = newSurface;
- if (!d->bufferLocked) {
- d->currentBuffer = QWaylandBufferRef();
- d->currentDamage = QRegion();
- }
+ nextBuffer = QWaylandBufferRef();
+ nextBufferCommitted = false;
+ nextDamage = QRegion();
- d->nextBuffer = QWaylandBufferRef();
- d->nextBufferCommitted = false;
- d->nextDamage = QRegion();
+ if (surface) {
+ QWaylandSurfacePrivate::get(surface)->refView(q);
+ if (output)
+ QWaylandOutputPrivate::get(output)->addView(q, surface);
+ }
+}
- if (d->surface) {
- QWaylandSurfacePrivate::get(d->surface)->refView(this);
- if (d->output)
- QWaylandOutputPrivate::get(d->output)->addView(this, d->surface);
+void QWaylandViewPrivate::clearFrontBuffer()
+{
+ if (!bufferLocked) {
+ currentBuffer = QWaylandBufferRef();
+ currentDamage = QRegion();
}
+}
- emit surfaceChanged();
+void QWaylandView::setSurface(QWaylandSurface *newSurface)
+{
+ Q_D(QWaylandView);
+ if (d->surface == newSurface)
+ return;
+ d->setSurface(newSurface);
+ d->clearFrontBuffer();
+ emit surfaceChanged();
}
/*!
diff --git a/src/compositor/compositor_api/qwaylandview_p.h b/src/compositor/compositor_api/qwaylandview_p.h
index b9cb0d07..e7f521af 100644
--- a/src/compositor/compositor_api/qwaylandview_p.h
+++ b/src/compositor/compositor_api/qwaylandview_p.h
@@ -74,6 +74,8 @@ public:
{ }
void markSurfaceAsDestroyed(QWaylandSurface *surface);
+ void setSurface(QWaylandSurface *newSurface);
+ void clearFrontBuffer();
QObject *renderObject = nullptr;
QWaylandSurface *surface = nullptr;