Skip to content

[tmva][sofie] Delete copying of SOFIE-emitted session classes - #23627

Closed
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:sofie-copy-footgun
Closed

guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:sofie-copy-footgun

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Some data members of the session classes are pointers to memory owned by the session class, so the session can't be trivially copied.

Instead of implementing a proper copy constructor and copy assignment, just delete them because they are also not needed.

Some data members of the session classes are pointers to memory owned by
the session class, so the session can't be trivially copied.

Instead of implementing a proper copy constructor and copy assignment,
just delete them because they are also not needed.
@guitargeek guitargeek self-assigned this Oct 6, 2026
@guitargeek
guitargeek requested a review from lmoneta as a code owner October 6, 2026 13:43
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Test Results

    24 files      24 suites   3d 22h 42m 43s ⏱️
 3 883 tests  3 878 ✅ 0 💤  5 ❌
83 075 runs  83 040 ✅ 0 💤 35 ❌

For more details on these failures, see this check.

Results for commit 6c0a38e.

@silverweed

silverweed commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Actually, is the class even allowed to move, since it has self-referencing pointers?

Probably yes, but the move ctor cannot just be the default one, otherwise the moved pointer still points to the old object, no?

@guitargeek

guitargeek commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

The members of the class are std::vectors and raw pointers that point into specific places of the vectors. If the vectors are moved, the memory stays at the same place I think. So should be fine.

I'll clarify that in the inline comments because indeed if the self-referencing pointer points to this that would be a problem

silverweed

This comment was marked as outdated.

@silverweed

Copy link
Copy Markdown
Contributor

The members of the class are std::vectors and raw pointers that point into specific places of the vectors

Why use pointers at all btw? Why not just store indices, which would even make the class copyable?

@guitargeek

Copy link
Copy Markdown
Contributor Author

Good idea! This would be a bigger refactor though. Maybe let's for now focus on the minimal fix #23624 so we can resolve the CI failures.

@guitargeek guitargeek closed this Oct 7, 2026
@guitargeek
guitargeek deleted the sofie-copy-footgun branch October 7, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants