PD: Fix possible crashes in dress-up task panels

This commit is contained in:
wmayer
2024-07-18 15:13:29 +02:00
parent 839fd1fec0
commit c1a7edc221
6 changed files with 162 additions and 123 deletions

View File

@@ -115,13 +115,16 @@ void TaskFilletParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
void TaskFilletParameters::onCheckBoxUseAllEdgesToggled(bool checked)
{
if (checked)
setSelectionMode(none);
PartDesign::Fillet* pcFillet = static_cast<PartDesign::Fillet*>(DressUpView->getObject());
ui->buttonRefSel->setEnabled(!checked);
ui->listWidgetReferences->setEnabled(!checked);
pcFillet->UseAllEdges.setValue(checked);
pcFillet->getDocument()->recomputeFeature(pcFillet);
if (auto fillet = getObject<PartDesign::Fillet>()) {
if (checked) {
setSelectionMode(none);
}
ui->buttonRefSel->setEnabled(!checked);
ui->listWidgetReferences->setEnabled(!checked);
fillet->UseAllEdges.setValue(checked);
fillet->recomputeFeature();
}
}
void TaskFilletParameters::setButtons(const selectionModes mode)
@@ -142,13 +145,14 @@ void TaskFilletParameters::onAddAllEdges()
void TaskFilletParameters::onLengthChanged(double len)
{
setSelectionMode(none);
PartDesign::Fillet* pcFillet = static_cast<PartDesign::Fillet*>(DressUpView->getObject());
setupTransaction();
pcFillet->Radius.setValue(len);
pcFillet->getDocument()->recomputeFeature(pcFillet);
// hide the fillet if there was a computation error
hideOnError();
if (auto fillet = getObject<PartDesign::Fillet>()) {
setSelectionMode(none);
setupTransaction();
fillet->Radius.setValue(len);
fillet->recomputeFeature();
// hide the fillet if there was a computation error
hideOnError();
}
}
double TaskFilletParameters::getLength() const