+ double check that internal data is valid when leaving edit mode of sketcher view provider

This commit is contained in:
wmayer 2015-11-02 12:42:18 +01:00
parent caec2d98a0
commit 85ac79aaf2

View File

@ -4545,19 +4545,21 @@ void ViewProviderSketch::unsetEdit(int ModNum)
ShowGrid.setValue(false);
TightGrid.setValue(true);
if (edit->sketchHandler)
deactivateHandler();
if (edit) {
if (edit->sketchHandler)
deactivateHandler();
edit->EditRoot->removeAllChildren();
pcRoot->removeChild(edit->EditRoot);
edit->EditRoot->removeAllChildren();
pcRoot->removeChild(edit->EditRoot);
if (edit->visibleBeforeEdit)
this->show();
else
this->hide();
if (edit->visibleBeforeEdit)
this->show();
else
this->hide();
delete edit;
edit = 0;
delete edit;
edit = 0;
}
try {
// and update the sketch
@ -4571,10 +4573,10 @@ void ViewProviderSketch::unsetEdit(int ModNum)
std::string ObjName = getSketchObject()->getNameInDocument();
std::string DocName = getSketchObject()->getDocument()->getName();
Gui::Selection().addSelection(DocName.c_str(),ObjName.c_str());
connectUndoDocument.disconnect();
connectRedoDocument.disconnect();
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();
}