diff options
author | Thomas Senyk <thomas.senyk@qt.io> | 2023-11-30 15:09:34 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-01-18 22:38:18 +0000 |
commit | 34c0858e78732e810471d06687c375c7c46394bb (patch) | |
tree | 2b0a48fb31d58c90057b741694f9a7b3a4040724 | |
parent | c991b34f232d84e34cb15f4c6f25ccaef74e3499 (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.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>
(cherry picked from commit 01ef243b5478f249adf0532aa6639de462e9957d)
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++) { |