summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2024-04-19 14:30:15 +0800
committerTim Blechmann <tim@klingt.org>2024-04-23 09:20:17 +0800
commitd139642aefde2d00683cf29f3875ccfae6c66779 (patch)
tree153af210882dddf739007af5ec0bf3a7e4f2c59b /src/gui/kernel
parent8d8cbe87e21f05b7d611ed4be47299977288b267 (diff)
Gui: fix memory leak in QGuiGLThreadContext
`QCoreApplicationPrivate::cleanupThreadData` calls `~QGuiGLThreadContext`, which calls `QOpenGLContextPrivate::setCurrentContext`, which creates a new `QGuiGLThreadContext`, which is not destroyed anymore. since `~QGuiGLThreadContext` sets a nullptr we exit early. Fixes: QTBUG-124538 Pick-to: 6.7 Change-Id: I51e40fcf8fd1169a4dfd336fac9c82f44d42f68e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 02781f4aa0..dd41318f72 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -170,6 +170,9 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context
qWarning("No QTLS available. currentContext won't work");
return nullptr;
}
+ if (!context)
+ return nullptr;
+
threadContext = new QGuiGLThreadContext;
qwindow_context_storage()->setLocalData(threadContext);
}