PD: do not use active document in task dialogs because this is error-prone

This commit is contained in:
wmayer
2020-09-15 13:21:32 +02:00
parent 7d392d1209
commit dc7de6b195
2 changed files with 15 additions and 12 deletions

View File

@@ -27,7 +27,7 @@
#endif
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <Gui/CommandT.h>
#include <Gui/MainWindow.h>
#include <Gui/BitmapFactory.h>
#include <Mod/PartDesign/App/Feature.h>
@@ -110,7 +110,7 @@ bool TaskDlgFeatureParameters::accept() {
FCMD_OBJ_HIDE(previous);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
Gui::cmdAppDocument(feature, "recompute()");
if (!feature->isValid()) {
throw Base::RuntimeError(vp->getObject()->getStatusString());
@@ -125,7 +125,7 @@ bool TaskDlgFeatureParameters::accept() {
param->detachSelection();
}
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
Gui::cmdGuiDocument(feature, "resetEdit()");
Gui::Command::commitCommand();
} catch (const Base::Exception& e) {
// Generally the only thing that should fail is feature->isValid() others should be fine