From 362cf1c80edb89957d81c0dbe6e50ce35daaa6db Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 5 Aug 2024 09:27:35 -0500 Subject: [PATCH] Gui: Fix crash in DlgSettingsLightSources Fixes #13357 --- src/Gui/PreferencePages/DlgSettingsLightSources.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp index 23b2f33133a9..934d5d4bb027 100644 --- a/src/Gui/PreferencePages/DlgSettingsLightSources.cpp +++ b/src/Gui/PreferencePages/DlgSettingsLightSources.cpp @@ -57,7 +57,6 @@ DlgSettingsLightSources::DlgSettingsLightSources(QWidget* parent) DlgSettingsLightSources::~DlgSettingsLightSources() { - delete view; } void DlgSettingsLightSources::setupConnection() @@ -73,14 +72,16 @@ void DlgSettingsLightSources::setupConnection() void DlgSettingsLightSources::showEvent(QShowEvent* event) { Q_UNUSED(event) - if (!view) { + static bool underConstruction = false; // Prevent recursion + if (!underConstruction && !view) { + underConstruction = true; QGroupBox* box = ui->groupBoxLight; QWidget* widget = createViewer(box); auto grid = new QGridLayout(box); grid->addWidget(widget); - box->setLayout(grid); loadDirection(); + underConstruction = false; } }