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.
This commit is contained in:
André Althaus
2024-02-21 14:56:23 +01:00
parent 30f5595e2a
commit a89d450a93

View File

@@ -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;
}
}