Blame SOURCES/0012-Fix-memory-leak-in-QWaylandGLContext.patch

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