mirror of https://github.com/qt/qt3d.git
RHI renderer: fix crash in Renderer::sendShaderChangesToFrontend()
The Shaders or the QShaderProgramBuilders may not exist in the managers anymore by the time we arrive in Renderer::sendShaderChangesToFrontend(). This happens when Qt3D shuts down. To fix this, check the returned values by the managers. This is similar to the existing patch for the OpenGL renderer: Ia021cd8f22ceb2626a7a2734b7e346fbcc8e0301 Pick-to: 6.4 Change-Id: I322bf2524016c1f98433891ad230b65272fabbdd Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
This commit is contained in:
parent
1fe1c5a375
commit
643d7889cc
|
|
@ -1528,6 +1528,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()));
|
||||
|
|
@ -1545,6 +1548,9 @@ void Renderer::sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager)
|
|||
for (const ShaderBuilderUpdate &update : m_shaderBuilderUpdates) {
|
||||
QShaderProgramBuilder *builder =
|
||||
static_cast<decltype(builder)>(manager->lookupNode(update.builderId));
|
||||
if (!builder)
|
||||
continue;
|
||||
|
||||
QShaderProgramBuilderPrivate *dBuilder =
|
||||
static_cast<decltype(dBuilder)>(QNodePrivate::get(builder));
|
||||
dBuilder->setShaderCode(update.shaderCode, update.shaderType);
|
||||
|
|
|
|||
Loading…
Reference in New Issue