From 3ecdd87fd7006e963df425fe14bd58b38dd232ec Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sun, 22 Nov 2026 12:11:48 +0100 Subject: [PATCH] CTF: fill an existing branch from the object passed now, not the first one EncodedBlocks::fillTreeBranch creates the branch with the address of the object passed at the first call and later only calls Fill(), so every later call fills from that first address. The callers pass a local of their own stack frame, so later fills read a dead object: with one thread the stale frame still happens to hold the data, but when the CTF writer runs on another thread it crashes at the second time frame. Point the branch at the current object before filling. --- .../Common/include/DetectorsCommonDataFormats/EncodedBlocks.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/EncodedBlocks.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/EncodedBlocks.h index ba6b853f7fb23..4011842fa7c97 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/EncodedBlocks.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/EncodedBlocks.h @@ -725,6 +725,8 @@ inline size_t EncodedBlocks::fillTreeBranch(TTree& tree, const std::str if (!br) { br = tree.Branch(brname.c_str(), &dt, 512, splitLevel); br->SetCompressionLevel(compLevel); + } else { + br->SetObject(&dt); // dt may be a caller's local: never fill from where it was at the first call } return br->Fill(); }