From 7b0f8183413d5b627299814b3d7be08b6895bb5b Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 22 Aug 2019 18:33:32 +0300 Subject: [PATCH] Fix for the issue #2958: Application errors when Remove part --- src/Model/Model_Document.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 082a6c60f..b7a295935 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -892,9 +892,10 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron myDoc->Undo(); } + std::set aSubs; if (theWithSubs) { // undo for all subs - const std::set aSubs = subDocuments(); + aSubs = subDocuments(); std::set::iterator aSubIter = aSubs.begin(); for (; aSubIter != aSubs.end(); aSubIter++) { if (!subDoc(*aSubIter)->myObjs) @@ -907,6 +908,19 @@ void Model_Document::undoInternal(const bool theWithSubs, const bool theSynchron myObjs->synchronizeFeatures(aDeltaLabels, true, false, false, isRoot()); // update the current features status setCurrentFeature(currentFeature(false), false); + + if (theWithSubs) { + // undo for all subs + const std::set aNewSubs = subDocuments(); + std::set::iterator aNewSubIter = aNewSubs.begin(); + for (; aNewSubIter != aNewSubs.end(); aNewSubIter++) { + // synchronize only newly appeared documents + if (!subDoc(*aNewSubIter)->myObjs || aSubs.find(*aNewSubIter) != aSubs.end()) + continue; + TDF_LabelList anEmptyDeltas; + subDoc(*aNewSubIter)->myObjs->synchronizeFeatures(anEmptyDeltas, true, false, true, true); + } + } } } -- 2.39.2