ID references made model not able to load in 2 passes
ObjectStore used to replace object factories with actual objects only after 2 passes instead of after first pass as it was before then. Until that happened object could not be obtained from outside despite it was already created by the 2nd pass so ID reference resolution that happened on the second pass failed. With this fix ObjectStore doesn't tries to hide partially-initialized objects anymore. So if object A references object B by ID it may get B after B has been loaded but before its .init was called. That's not a problem because we just loading (relinking) model and do not depend on anything that could be initialized in B's .init. However because B is not owned by A and A is not owned by B it may happen that .init of A will be executed prior to .init of B so if A's initializer will see object B that wasn't initialized yet. Generally this is unavoidable because there may be circular references. So there were 2 options: either to do more that 2 passes and try to to avoid such situations for cases when there are no circular references or just require classes not to do anything with objects they don't own from .init. Because .init is also called from GC and should not have side effects at all the second options was chosen but we may reconsider this in the future Closes-Bug: #1492640 Change-Id: Id38a780f9084323f0806b044262aa3b89eb5da74
This commit is contained in:
parent
d5c6bdf594
commit
024ac109ef
@ -39,7 +39,7 @@ class ObjectStore(object):
|
||||
if object_id in self._store:
|
||||
result = self._store[object_id]
|
||||
if not isinstance(result, dsl_types.MuranoObject):
|
||||
result = None
|
||||
result = result.object
|
||||
return result
|
||||
if self._parent_store:
|
||||
return self._parent_store.get(object_id)
|
||||
|
Loading…
Reference in New Issue
Block a user