-
Notifications
You must be signed in to change notification settings - Fork 277
Description
Describe the bug
In GateToRoot::RecordEndOfAcquisition() the line
m_hfile = m_treesHit[0]->GetCurrentFile();
causes a segfault. This is because RecordEndOfAcquisition() is called after RecordEndOfRun() which clears m_treesHit.
Confusingly, this is 100% repeatable on my system for a variety of simple example macros,, however does not appear on other systems at all, thus leading me to suspect it's a use-after-free.
Desktop (please complete the following information):
- OS: Manjaro linux
- Gate version or commit hash: v9.4.1
- Geant4 version: v11.2.0
- Root version: v6.36.02
- compiler version: g++ v13.3.1
Minimal example
main.mac: https://github.com/BenAuer2021/Simulation-And-Reconstruction-Of-Nuclear-Medicine-Imaging-Systems-PET/blob/main/main.mac
Gate main.mac
Expected behavior
No segfault!
Additional context
I can trivially fix the issue by commenting the GateToRoot::RecordEndOfRun() line
m_treesHit.clear();
but I wonder if I'm missing something.
No error seen on colleague's Mac with otherwise similar software.