From 85ac79aaf2f82f8d37829a60b0786e0b4b2d51ee Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 2 Nov 2015 12:42:18 +0100 Subject: [PATCH] + double check that internal data is valid when leaving edit mode of sketcher view provider --- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 26 +++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 6135cb39bf..287ad0746e 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -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(); }