std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
if (isOk) {
+ // keep handle to avoid destruction of the document until myObjs works on it
+ Handle(TDocStd_Document) anOldDoc = myDoc;
myDoc = aLoaded;
myDoc->SetUndoLimit(UNDO_LIMIT);
aSession->setCheckTransactions(false);
if (myObjs)
delete myObjs;
+ anOldDoc.Nullify();
myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
myObjs->setOwner(theThis);
// update the current features status
{
Transaction anAppended = myTransactions.back();
myTransactions.pop_back();
+ if (!myNestedNum.empty())
+ (*myNestedNum.rbegin())--;
if (!myTransactions.empty()) { // if it is empty, just forget the appended
myTransactions.back().myOCAFNum += anAppended.myOCAFNum;
}