Skip to content

Commit

Permalink
App: fix Link document restore
Browse files Browse the repository at this point in the history
This fixes issue #4224
  • Loading branch information
realthunder authored and wwmayer committed Feb 14, 2020
1 parent 8b68ab7 commit 0a608e9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/App/Application.cpp
Expand Up @@ -703,6 +703,9 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
_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);
Expand Down
11 changes: 11 additions & 0 deletions src/App/PropertyLinks.cpp
Expand Up @@ -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());
Expand Down Expand Up @@ -3423,6 +3430,10 @@ bool PropertyXLink::hasXLink(
return ret;
}

void PropertyXLink::restoreDocument(const App::Document &doc) {
DocInfo::restoreDocument(doc);
}

std::map<App::Document*,std::set<App::Document*> >
PropertyXLink::getDocumentOutList(App::Document *doc) {
std::map<App::Document*,std::set<App::Document*> > ret;
Expand Down
1 change: 1 addition & 0 deletions src/App/PropertyLinks.h
Expand Up @@ -1107,6 +1107,7 @@ class AppExport PropertyXLink : public PropertyLinkGlobal
static bool hasXLink(const std::vector<App::DocumentObject*> &objs, std::vector<App::Document*> *unsaved=0);
static std::map<App::Document*,std::set<App::Document*> > getDocumentOutList(App::Document *doc=0);
static std::map<App::Document*,std::set<App::Document*> > getDocumentInList(App::Document *doc=0);
static void restoreDocument(const App::Document &doc);

virtual void updateElementReference(
DocumentObject *feature,bool reverse=false, bool notify=false) override;
Expand Down

0 comments on commit 0a608e9

Please sign in to comment.