diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index a8f13a80befb..99a4de264d0d 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -1092,9 +1092,15 @@ void StdCmdDelete::activated(int iMsg) // handle the view provider Gui::getMainWindow()->setUpdatesEnabled(false); - (*it)->openTransaction("Delete"); - vpedit->onDelete(ft->getSubNames()); - (*it)->commitTransaction(); + try { + (*it)->openTransaction("Delete"); + vpedit->onDelete(ft->getSubNames()); + (*it)->commitTransaction(); + } + catch (const Base::Exception& e) { + (*it)->abortTransaction(); + e.ReportException(); + } Gui::getMainWindow()->setUpdatesEnabled(true); Gui::getMainWindow()->update(); @@ -1171,18 +1177,24 @@ void StdCmdDelete::activated(int iMsg) if (autoDeletion) { Gui::getMainWindow()->setUpdatesEnabled(false); - (*it)->openTransaction("Delete"); - for (std::vector::iterator ft = sel.begin(); ft != sel.end(); ++ft) { - Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject()); - if (vp) { - // ask the ViewProvider if it wants to do some clean up - if (vp->onDelete(ft->getSubNames())) { - doCommand(Doc,"App.getDocument(\"%s\").removeObject(\"%s\")" - ,(*it)->getName(), ft->getFeatName()); + try { + (*it)->openTransaction("Delete"); + for (std::vector::iterator ft = sel.begin(); ft != sel.end(); ++ft) { + Gui::ViewProvider* vp = pGuiDoc->getViewProvider(ft->getObject()); + if (vp) { + // ask the ViewProvider if it wants to do some clean up + if (vp->onDelete(ft->getSubNames())) { + doCommand(Doc,"App.getDocument(\"%s\").removeObject(\"%s\")" + ,(*it)->getName(), ft->getFeatName()); + } } } + (*it)->commitTransaction(); + } + catch (const Base::Exception& e) { + (*it)->abortTransaction(); + e.ReportException(); } - (*it)->commitTransaction(); Gui::getMainWindow()->setUpdatesEnabled(true); Gui::getMainWindow()->update();