diff options
author | David Edmundson <davidedmundson@kde.org> | 2022-09-12 13:28:08 +0100 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2022-09-12 14:47:34 +0100 |
commit | 50f1ccc66c68f9f4c0b08400747942109c16b2be (patch) | |
tree | 616213718f4caac1dfa6cbfe14399c7ee4fa4ee2 /src/hardwareintegration | |
parent | 3e4a86b942decec51dd8477d220f1c1c4d0af8ec (diff) | |
download | qtwayland-50f1ccc66c68f9f4c0b08400747942109c16b2be.tar.gz |
Hold surface read lock throughout QWaylandEglWindow::updateSurface
QWaylandEGLWindow::updateSurface is called from both the main and render
threads. It is called on the render thread when making the surface
current, which could be after the window is hidden if there are cleanup
jobs to be done.
Whilst the getter wlSurface() holds a read lock, it's not enough as we
need the instance alive between the two calls and throughout the mesa
code.
This potentially fixes a crash seen in mesa where we crash creating a
surface for an invalid wl_surface object.
Change-Id: I497356e752ffaf3549d174f10c4c268234b02cbd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r-- | src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp index bf37572d..74c84f76 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -4,6 +4,7 @@ #include "qwaylandeglwindow_p.h" #include <QtWaylandClient/private/qwaylandscreen_p.h> +#include <QtWaylandClient/private/qwaylandsurface_p.h> #include "qwaylandglcontext_p.h" #include <QtGui/private/qeglconvenience_p.h> @@ -79,6 +80,7 @@ void QWaylandEglWindow::updateSurface(bool create) } mOffset = QPoint(); } else { + QReadLocker locker(&mSurfaceLock); if (m_waylandEglWindow) { int current_width, current_height; static bool disableResizeCheck = qgetenv("QT_WAYLAND_DISABLE_RESIZECHECK").toInt(); @@ -93,8 +95,8 @@ void QWaylandEglWindow::updateSurface(bool create) m_resize = true; } - } else if (create && wlSurface()) { - m_waylandEglWindow = wl_egl_window_create(wlSurface(), sizeWithMargins.width(), sizeWithMargins.height()); + } else if (create && mSurface) { + m_waylandEglWindow = wl_egl_window_create(mSurface->object(), sizeWithMargins.width(), sizeWithMargins.height()); m_requestedSize = sizeWithMargins; } |