libqt5-qt3d/0001-Handle-nullptr-returned-from-the-shader-manager.patch

33 lines
1.5 KiB
Diff

From dc1f843c89ca233783771c747380ab96d63e20d8 Mon Sep 17 00:00:00 2001
From: Martin Andersson <martin.andersson@evoma.se>
Date: Thu, 17 Nov 2022 14:37:05 +0100
Subject: [PATCH] Handle nullptr returned from the shader manager
Sometimes the shader manager returns a nullptr when fetching the shader from a handle, so the return value needs to be checked before it is accessed.
Change-Id: Ia021cd8f22ceb2626a7a2734b7e346fbcc8e0301
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit bffdaabaa5cd9d7fdc64e4124817b504319708e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/plugins/renderers/opengl/renderer/renderer.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp
index d8d24204d3..7dcbbf1841 100644
--- a/src/plugins/renderers/opengl/renderer/renderer.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderer.cpp
@@ -1180,6 +1180,9 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
const std::vector<HShader> &activeShaders = m_nodesManager->shaderManager()->activeHandles();
for (const HShader &handle :activeShaders) {
Shader *s = m_nodesManager->shaderManager()->data(handle);
+ if (!s)
+ continue;
+
if (s->requiresFrontendSync()) {
QShaderProgram *frontend = static_cast<decltype(frontend)>(manager->lookupNode(s->peerId()));
// Could happen as a backend shader might live beyong the frontend
--
GitLab