Fix crash when user click 'Close' button while Dimension is active.

TaskDlgEditSketch didn't purge the handler first as is doing CmdSketcherLeaveSketch.
This commit is contained in:
Paddle
2023-08-27 09:26:44 +02:00
parent f1f31fd3df
commit a683f3aca4
2 changed files with 4 additions and 1 deletions

View File

@@ -1061,7 +1061,6 @@ public:
void deactivated() override
{
Gui::Command::abortCommand();
//TODO: When user exit sketch edit while tool is activated solve() crashes. solve is needed to refresh the sketch after abortCommand
Obj->solve();
sketchgui->draw(false, false); // Redraw
}

View File

@@ -100,6 +100,10 @@ bool TaskDlgEditSketch::reject()
hGrp->SetBool("ExpandedConstraintsWidget", Constraints->isGroupVisible());
hGrp->SetBool("ExpandedElementsWidget", Elements->isGroupVisible());
if (sketchView && sketchView->getSketchMode() != ViewProviderSketch::STATUS_NONE) {
sketchView->purgeHandler();
}
std::string document = getDocumentName();// needed because resetEdit() deletes this instance
Gui::Command::doCommand(
Gui::Command::Gui, "Gui.getDocument('%s').resetEdit()", document.c_str());