Commit fc25980
Free G4World's G4Volume wrappers; forbid copy/move to avoid double-free
G4World stored raw G4Volume* wrappers in g4volumesMap but had no
destructor, so every g4world.reset() on geometry reload leaked one
wrapper per volume — unbounded growth in long interactive sessions.
Add a destructor that deletes the wrappers (Geant4 owns the contained
solid/logical/physical objects, so only the lightweight GEMC wrappers are
freed). Because G4World previously inherited GBase's defaulted copy/move,
adding an owning destructor would make a shallow copy double-free; G4World
is only ever held by shared_ptr, so delete copy and move to forbid
relocation. Verified the deletions don't break the build (nothing copies
or moves G4World).
Fixes #135
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 48f83e5 commit fc25980
1 file changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
66 | 79 | | |
67 | 80 | | |
68 | 81 | | |
| |||
0 commit comments