diff options
-rw-r--r-- | src/client/qwaylandwindow.cpp | 20 | ||||
-rw-r--r-- | src/client/qwaylandwindow_p.h | 2 | ||||
-rw-r--r-- | src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp | 1 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index d32b4fce3..06303de3a 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -416,6 +416,7 @@ void QWaylandWindow::closePopups(QWaylandWindow *parent) QPlatformScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const { + QReadLocker lock(&mSurfaceLock); if (mSurface) { if (auto *screen = mSurface->oldestEnteredScreen()) return screen; @@ -469,6 +470,7 @@ void QWaylandWindow::setMask(const QRegion &mask) mMask = mask; + QReadLocker locker(&mSurfaceLock); if (!mSurface) return; @@ -555,6 +557,10 @@ void QWaylandWindow::sendRecursiveExposeEvent() void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) { Q_ASSERT(!buffer->committed()); + QReadLocker locker(&mSurfaceLock); + if (mSurface == nullptr) + return; + if (buffer) { handleUpdate(); buffer->setBusy(); @@ -573,6 +579,10 @@ void QWaylandWindow::attachOffset(QWaylandBuffer *buffer) void QWaylandWindow::damage(const QRect &rect) { + QReadLocker locker(&mSurfaceLock); + if (mSurface == nullptr) + return; + mSurface->damage(rect.x(), rect.y(), rect.width(), rect.height()); } @@ -603,6 +613,8 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) qCDebug(lcWaylandBackingstore) << "Buffer already committed, ignoring."; return; } + + QReadLocker locker(&mSurfaceLock); if (!mSurface) return; @@ -616,7 +628,9 @@ void QWaylandWindow::commit(QWaylandBuffer *buffer, const QRegion &damage) void QWaylandWindow::commit() { - mSurface->commit(); + QReadLocker locker(&mSurfaceLock); + if (mSurface != nullptr) + mSurface->commit(); } const wl_callback_listener QWaylandWindow::callbackListener = { @@ -707,6 +721,7 @@ QPointF QWaylandWindow::mapFromWlSurface(const QPointF &surfacePosition) const wl_surface *QWaylandWindow::wlSurface() { + QReadLocker locker(&mSurfaceLock); return mSurface ? mSurface->object() : nullptr; } @@ -731,7 +746,8 @@ QWaylandScreen *QWaylandWindow::waylandScreen() const void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation) { - if (mDisplay->compositorVersion() < 2) + QReadLocker locker(&mSurfaceLock); + if (mDisplay->compositorVersion() < 2 || mSurface == nullptr) return; wl_output_transform transform; diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index 1dbb6f995..45eefdbf2 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -287,7 +287,7 @@ private: static QWaylandWindow *mMouseGrab; - QReadWriteLock mSurfaceLock; + mutable QReadWriteLock mSurfaceLock; friend class QWaylandSubSurface; }; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index 756eb3cd3..5145d1876 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -192,7 +192,6 @@ public: } void blit(QWaylandEglWindow *window) { - Q_ASSERT(window->wlSurface()); QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context()); QSize surfaceSize = window->surfaceSize(); |