summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-08-02 13:35:29 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-08-02 13:51:03 +0200
commit26c4e47afacf8b4072fb8500111fe471672e7e37 (patch)
treea62664e34833f8dfab097bba86a7cc8446d8d084
parentd9dd7f4896cbc0fe1dc37e517c28315419e6ffcd (diff)
AVFoundation: Fix memory leak when gl context is changed
I might happen when shareContext remains the same but current context has been changed few times. Change-Id: I55a7a9eab03776e3d1ca6d32117de6714692bbf0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
index 0759702e8..62ee13d25 100644
--- a/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
+++ b/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm
@@ -135,12 +135,14 @@ QOpenGLFramebufferObject *AVFVideoFrameRenderer::initRenderer(AVPlayerLayer *lay
|| (!QOpenGLContext::currentContext() && !m_glContext)) {
//Create Hidden QWindow surface to create context in this thread
+ delete m_offscreenSurface;
m_offscreenSurface = new QWindow();
m_offscreenSurface->setSurfaceType(QWindow::OpenGLSurface);
//Needs geometry to be a valid surface, but size is not important
m_offscreenSurface->setGeometry(0, 0, 1, 1);
m_offscreenSurface->create();
+ delete m_glContext;
m_glContext = new QOpenGLContext();
m_glContext->setFormat(m_offscreenSurface->requestedFormat());