Sketcher: try fix crash when returning to PartDesign

This commit is contained in:
DeepSOIC
2019-09-09 01:08:57 +03:00
committed by wmayer
parent fb5d7fa076
commit a073eb6749

View File

@@ -6088,24 +6088,6 @@ void ViewProviderSketch::unsetEdit(int ModNum)
Gui::coinRemoveAllChildren(edit->EditRoot);
pcRoot->removeChild(edit->EditRoot);
//visibility autoation
try{
QString cmdstr = QString::fromLatin1(
"ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"tv = ActiveSketch.ViewObject.TempoVis\n"
"if tv:\n"
" tv.restore()\n"
"ActiveSketch.ViewObject.TempoVis = None\n"
"del(tv)\n"
).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg(
QString::fromLatin1(getSketchObject()->getNameInDocument()));
QByteArray cmdstr_bytearray = cmdstr.toLatin1();
Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);
} catch (Base::PyException &e){
Base::Console().Error("ViewProviderSketch::unsetEdit: visibility automation failed with an error: \n");
e.ReportException();
}
delete edit;
edit = 0;
this->detachSelection();
@@ -6129,6 +6111,24 @@ void ViewProviderSketch::unsetEdit(int ModNum)
// when pressing ESC make sure to close the dialog
Gui::Control().closeDialog();
//visibility autoation
try{
QString cmdstr = QString::fromLatin1(
"ActiveSketch = App.getDocument('%1').getObject('%2')\n"
"tv = ActiveSketch.ViewObject.TempoVis\n"
"if tv:\n"
" tv.restore()\n"
"ActiveSketch.ViewObject.TempoVis = None\n"
"del(tv)\n"
).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg(
QString::fromLatin1(getSketchObject()->getNameInDocument()));
QByteArray cmdstr_bytearray = cmdstr.toLatin1();
Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);
} catch (Base::PyException &e){
Base::Console().Error("ViewProviderSketch::unsetEdit: visibility automation failed with an error: \n");
e.ReportException();
}
}
void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int ModNum)