From 2ea3b1b5f12ed40a12a0b653c7846f9d48daf3da Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 17 Sep 2015 19:30:03 +0300 Subject: [PATCH] Fix for the crash on import of OpenParts document from the SALOME study with the opened Session --- src/Model/Model_Document.cpp | 5 +++-- src/Model/Model_Objects.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index e2a002640..b16353816 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -106,7 +106,7 @@ bool Model_Document::load(const char* theFileName, DocumentPtr theThis) TCollection_ExtendedString aPath(DocFileName(theFileName, myID)); PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1; try { - aStatus = anApp->Open(aPath, myDoc); + aStatus = anApp->Open(aPath, aLoaded); } catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); Events_Error::send( @@ -168,6 +168,7 @@ bool Model_Document::load(const char* theFileName, DocumentPtr theThis) } } if (!isError) { + myDoc = aLoaded; myDoc->SetUndoLimit(UNDO_LIMIT); // to avoid the problem that feature is created in the current, not this, document std::shared_ptr aSession = @@ -1024,7 +1025,7 @@ void Model_Document::synchronizeTransactions() }*/ } -// Feature that is used for selection in the Part document by the external request +/// Feature that is used for selection in the Part document by the external request class Model_SelectionInPartFeature : public ModelAPI_Feature { public: /// Nothing to do in constructor diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 48c79ab8d..82831c710 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -78,6 +78,7 @@ Model_Objects::~Model_Objects() aFeature->erase(); myFeatures.UnBind(aFeaturesIter.Key()); } + myHistory.clear(); aLoop->activateFlushes(isActive); // erase update, because features are destroyed and update should not performed for them anywhere aLoop->eraseMessages(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); -- 2.39.2