summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Senyk <thomas.senyk@qt.io>2023-11-30 15:09:34 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-01-18 15:44:15 +0000
commit01ef243b5478f249adf0532aa6639de462e9957d (patch)
tree1e42b6a7feff361b0a2bcaabd8e2bd631d0f73a7
parent02d54154932ffdeae9d926c2a314481838dc117d (diff)
client texture cleanup: fix crash in clean-up lambda
The dtor of WaylandEgl[Stream]ClientBuffer used to only clean-up the aboutToBeDestroyed-connection/lambda if it's integration is still present. This was a pointless condition as that clean-up is not depending on the integration and can lead to access of dead memory (when the Buffer is already deleted but the lambda is then later called due to QOpenGLContext::aboutToBeDestroyed) Fixed by moving the clean-up into it's own scope (needs a scope due to QMutexLocker) Pick-to: 6.6 6.5 Change-Id: Ib3b6e54365f66484f249ee449cb3b27029f5ce7c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit acce7bc40d287eff826cd97dbea595da3050669f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp2
-rw-r--r--src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
index 38b0e0c4b..c8819ba1f 100644
--- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp
@@ -525,7 +525,9 @@ WaylandEglClientBuffer::~WaylandEglClientBuffer()
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
+ }
+ {
QMutexLocker locker(&d->texturesLock);
for (int i=0; i<3; i++) {
diff --git a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
index 02d289ce0..0924f0fd7 100644
--- a/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
+++ b/src/hardwareintegration/compositor/wayland-eglstream-controller/waylandeglstreamintegration.cpp
@@ -399,7 +399,9 @@ WaylandEglStreamClientBuffer::~WaylandEglStreamClientBuffer()
if (p) {
if (d->egl_stream)
p->funcs->destroy_stream(p->egl_display, d->egl_stream);
+ }
+ {
QMutexLocker locker(&d->texturesLock);
for (int i=0; i<3; i++) {