From 6858382d5642a83e6345a32bba1b8b74ec8144df Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 16 Jan 2015 16:44:53 +0300 Subject: [PATCH] Fix for the issue #294 : do not erase internal data structure of document on close: it may be undone --- src/Model/Model_Document.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 915ce9365..65d4cb70b 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -258,9 +258,15 @@ void Model_Document::close(const bool theForever) ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_Feature::group()); ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP); aFeature->eraseResults(); - aFeature->erase(); + if (theForever) { // issue #294: do not delete content of the document until it can be redone + aFeature->erase(); + } else { + aFeature->data()->execState(ModelAPI_StateMustBeUpdated); + } + } + if (theForever) { + myObjs.Clear(); } - myObjs.Clear(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); @@ -461,7 +467,7 @@ void Model_Document::redo() subDoc(*aSubIter)->redo(); } -/// Appenad to the array of references a new referenced label +/// Append to the array of references a new referenced label static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced) { Handle(TDataStd_ReferenceArray) aRefs; -- 2.39.2