Manifest copy constructor does not deeply copy individual section Attributes
philipp.kunz at paratix.ch
Sat Jan 19 19:34:44 UTC 2019
Just after having sent the previous mail I found Manifest::clone
explicitly says it creates a shallow copy which is true only to a
certain extent. It deeply copies main attributes as well as individual
sections map already now and only shallowly copies individual sections
I don't know about the background of it or why clone should only do a
shallow copy but if clone should really create a shallow copy, it
should probably create an even more shallow copy. In any case I figure
some potential for clarification at least.
Probably mostly because I already began a patch in the previous
message, I continued and attached another patch for a deep copy
approach. There might still be some reason not to deeply copy manifests
which I don't intend to forestall.
On Sat, 2019-01-19 at 19:32 +0100, Philipp Kunz wrote:
> Creating a new manifest as a copy from an existing one using the copy
> constructor assigns the new manifest individual sections entries map
> the same values which are references to attributes as the original
> rather than copying them as well deeply resulting in two manifests
> pointing to the same attributes instances modifications to which
> always affect both manifests. See test and proposed fix in the
> attached patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7429 bytes
Desc: not available
More information about the core-libs-dev