From a89d450a9321f8ae039bfd42aca782ad765c2dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Althaus?= Date: Wed, 21 Feb 2024 14:56:23 +0100 Subject: [PATCH] Fix crash when canceling the MultiTransform panel while a newly cretated subfeature is edited Before calling the closeSubTask() function from the dialog reject() function, the slotDeletedObject() is called from the transaction being aborted. This causes the subFeature pointer to be nullptr and subsequent apply() functions from the SpinBox widgets to crash. Before calling apply check if the subFeature is still there. --- src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index 65fde209b3..1380e498d3 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -165,7 +165,11 @@ void TaskMultiTransformParameters::closeSubTask() if (subTask) { ui->buttonOK->hide(); exitSelectionMode(); - subTask->apply(); + // The subfeature can already be deleted (e.g. cancel) so we have to check before + // calling apply + if (subFeature) { + subTask->apply(); + } // Remove all parameter ui widgets and layout ui->subFeatureWidget->setUpdatesEnabled(false); @@ -177,6 +181,7 @@ void TaskMultiTransformParameters::closeSubTask() delete subTask; subTask = nullptr; + subFeature = nullptr; } }