ebefeac
From 9df11e79b46c77d8c83f765b2a8e85b639fd55a2 Mon Sep 17 00:00:00 2001
ebefeac
From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
ebefeac
Date: Tue, 5 Jan 2021 09:08:50 +0100
ebefeac
Subject: [PATCH 12/19] Fix memory leak in QWaylandGLContext
ebefeac
ebefeac
We were leaking an EGL context with every GL context created,
ebefeac
which lead to rapid OOM errors in stress tests.
ebefeac
ebefeac
[ChangeLog][Qt Wayland Client] Fixed a memory leak when creating
ebefeac
QOpenGLContexts on Wayland and using the wayland-egl backend.
ebefeac
ebefeac
Fixes: QTBUG-85608
ebefeac
Pick-to: 5.15
ebefeac
Pick-to: 6.0
ebefeac
Change-Id: I8426b5df36ec7ab9e66ce15f9e02edad3aca60b9
ebefeac
Reviewed-by: David Edmundson <davidedmundson@kde.org>
ebefeac
---
ebefeac
 .../client/wayland-egl/qwaylandglcontext.cpp                  | 4 +++-
ebefeac
 1 file changed, 3 insertions(+), 1 deletion(-)
ebefeac
ebefeac
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
ebefeac
index 681f82f4..befadedc 100644
ebefeac
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
ebefeac
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
ebefeac
@@ -406,7 +406,9 @@ void QWaylandGLContext::updateGLFormat()
ebefeac
 QWaylandGLContext::~QWaylandGLContext()
ebefeac
 {
ebefeac
     delete m_blitter;
ebefeac
-    eglDestroyContext(m_eglDisplay, m_context);
ebefeac
+    m_blitter = nullptr;
ebefeac
+    if (m_decorationsContext != EGL_NO_CONTEXT)
ebefeac
+        eglDestroyContext(eglDisplay(), m_decorationsContext);
ebefeac
 }
ebefeac
 
ebefeac
 bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
ebefeac
-- 
ebefeac
2.31.1
ebefeac