diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2023-10-30 15:07:06 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-30 21:12:20 +0000 |
commit | 8c6d53b15488d57e8b7ad921018e87b04434b781 (patch) | |
tree | 18bd61c19b7add99b22457c97749d7b336cd928b | |
parent | f87885b2493e3b099e9f2a2fa81acc227727c223 (diff) |
QVideoTextureHelper: add missing QVideoFrame::unmap() call
In QVideoTextureHelper::updateTextureWithMap() we do frame.map(),
but there is no corresponding frame.unmap() call, what may potentially
lead to memory leaks and/or other side effects. So adding a scope guard
to call frame.unmap() on any return from the function.
Task-number: QTBUG-118587
Pick-to: 6.5
Change-Id: I04062cfcd23698872e825bd88044e30858e8d12a
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit cf42eff34303a7009465c7fc71bd80b62a7b481f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/multimedia/video/qvideotexturehelper.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/multimedia/video/qvideotexturehelper.cpp b/src/multimedia/video/qvideotexturehelper.cpp index adaa066e4..9ba7cddf2 100644 --- a/src/multimedia/video/qvideotexturehelper.cpp +++ b/src/multimedia/video/qvideotexturehelper.cpp @@ -592,6 +592,8 @@ static bool updateTextureWithMap(QVideoFrame frame, QRhi *rhi, QRhiResourceUpdat return false; } + auto unmapFrameGuard = qScopeGuard([&frame] { frame.unmap(); }); + QVideoFrameFormat fmt = frame.surfaceFormat(); QVideoFrameFormat::PixelFormat pixelFormat = fmt.pixelFormat(); QSize size = fmt.frameSize(); |