Skip to content

Commit 07d8905

Browse files
XINJIANGMOiche033
andcommitted
Fix crash when setting debug visualization mode while gi is disabled (#3059)
Signed-off-by: momo <[email protected]> Co-authored-by: Ian Chen <[email protected]> (cherry picked from commit 019e38c)
1 parent bd672ee commit 07d8905

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/gui/plugins/global_illumination_vct/GlobalIlluminationVct.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,21 @@ bool GlobalIlluminationVct::eventFilter(QObject *_obj, QEvent *_event)
499499
}
500500
else if (this->dataPtr->debugVisualizationDirty)
501501
{
502-
this->dataPtr->gi->SetDebugVisualization(
502+
if (this->dataPtr->enabled && this->dataPtr->gi->Enabled())
503+
{
504+
this->dataPtr->gi->SetDebugVisualization(
503505
static_cast<rendering::GlobalIlluminationVct::DebugVisualizationMode>(
504-
this->dataPtr->debugVisMode));
506+
this->dataPtr->debugVisMode));
507+
}
508+
else
509+
{
510+
gzerr << "Trying to set debug visualization mode while GI is "
511+
<< "disabled. Please enable GI first."
512+
<< std::endl;
513+
// Always set to none when disabled to avoid crash
514+
this->dataPtr->gi->SetDebugVisualization(
515+
rendering::GlobalIlluminationVct::DVM_None);
516+
}
505517
this->dataPtr->debugVisualizationDirty = false;
506518
}
507519
}

0 commit comments

Comments
 (0)