From 0a608e94139ef94cbd58b578b7de24a911730adc Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 14 Dec 2019 11:55:52 +0800 Subject: [PATCH] App: fix Link document restore This fixes issue #0004224 --- src/App/Application.cpp | 3 +++ src/App/PropertyLinks.cpp | 11 +++++++++++ src/App/PropertyLinks.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 200640d8b768..9856433d6c68 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -703,6 +703,9 @@ std::vector Application::openDocuments(const std::vector _pendingDocMap.clear(); Base::SequencerLauncher seq("Postprocessing...", newDocs.size()); + for (auto &v : newDocs) + PropertyXLink::restoreDocument(*v.first); + for (auto &v : newDocs) { FC_TIME_INIT(t1); v.first->afterRestore(true); diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 3f7ba7a80ddc..390a773a79e7 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -2641,6 +2641,13 @@ class App::DocInfo : } } + static void restoreDocument(const App::Document &doc) { + auto it = _DocInfoMap.find(getFullPath(doc.FileName.getValue())); + if(it==_DocInfoMap.end()) + return; + it->second->slotFinishRestoreDocument(doc); + } + void slotFinishRestoreDocument(const App::Document &doc) { if(pcDoc) return; QString fullpath(getFullPath()); @@ -3423,6 +3430,10 @@ bool PropertyXLink::hasXLink( return ret; } +void PropertyXLink::restoreDocument(const App::Document &doc) { + DocInfo::restoreDocument(doc); +} + std::map > PropertyXLink::getDocumentOutList(App::Document *doc) { std::map > ret; diff --git a/src/App/PropertyLinks.h b/src/App/PropertyLinks.h index 5ac9517dcce1..9dfa74e8ecbc 100644 --- a/src/App/PropertyLinks.h +++ b/src/App/PropertyLinks.h @@ -1107,6 +1107,7 @@ class AppExport PropertyXLink : public PropertyLinkGlobal static bool hasXLink(const std::vector &objs, std::vector *unsaved=0); static std::map > getDocumentOutList(App::Document *doc=0); static std::map > getDocumentInList(App::Document *doc=0); + static void restoreDocument(const App::Document &doc); virtual void updateElementReference( DocumentObject *feature,bool reverse=false, bool notify=false) override;