Skip to content

Commit

Permalink
+ double check that internal data is valid when leaving edit mode of …
Browse files Browse the repository at this point in the history
…sketcher view provider
  • Loading branch information
wwmayer committed Nov 2, 2015
1 parent caec2d9 commit 85ac79a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -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
Expand All @@ -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();
}
Expand Down

0 comments on commit 85ac79a

Please sign in to comment.