Skip to content

DPL: Fix ownership of the content of Variant - #15939

Open
aalkin wants to merge 4 commits into
AliceO2Group:devfrom
aalkin:fix-variant
Open

aalkin wants to merge 4 commits into
AliceO2Group:devfrom
aalkin:fix-variant

Conversation

@aalkin

@aalkin aalkin commented Oct 12, 2026

Copy link
Copy Markdown
Member

Copy and move of Variants holding Array2D, LabeledArray or string array values copied the storage byte by byte, so copies shared the same heap buffers, and the destructor never destroyed these objects, leaking them. Assignments never released the previous content, move assignment of strings and arrays duplicated the buffer and dropped the original one, and move assignment of string arrays corrupted the source vector.

Prevent constructing a Variant from a temporary vector, as we cannot overtake the ownership of the vector's buffer and have to copy. Assignment from a temporary is left it, because it is used elsewhere in the code - it should be removed first.

Split from #15880.

Copy and move of Variants holding Array2D, LabeledArray or string array
values copied the storage byte by byte, so copies shared the same heap
buffers, and the destructor never destroyed these objects, leaking them.
Assignments never released the previous content, move assignment of
strings and arrays duplicated the buffer and dropped the original one,
and move assignment of string arrays corrupted the source vector.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants