Salome HOME
Updates for stability of application
[modules/shaper.git] / src / Model / Model_AttributeDocRef.cpp
index 93c8af71346ce82569f5cea6cf867f8b0d8ac55b..dfb307f4dbfe0981cc8915fc838cea6a798540a4 100644 (file)
@@ -36,5 +36,11 @@ Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
   if (!theLabel.FindAttribute(TDataStd_Comment::GetID(), myComment)) {
     // create attribute: not initialized by value yet, just empty string
     myComment = TDataStd_Comment::Set(theLabel, "");
+  } else { // document was already referenced: try to set it as loaded by demand
+    Handle(Model_Application) anApp = Model_Application::getApplication();
+    string anID(TCollection_AsciiString(myComment->Get()).ToCString());
+    if (!anApp->hasDocument(anID)) {
+      anApp->setLoadByDemand(anID);
+    }
   }
 }