Problem 1069 - G4CrossSectionDataSetRegistry may delete non-heap objects leading to crash on exit
Summary: G4CrossSectionDataSetRegistry may delete non-heap objects leading to crash on...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes (show other problems)
Version: 9.2
Hardware: All All
: P5 normal
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2009-06-02 23:07 CEST by Brett Viren
Modified: 2009-06-03 11:28 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Brett Viren 2009-06-02 23:07:28 CEST
Some processes (at least G4XxxNuclearProcess, Xxx=Photo, Electron and Positron)  hold cross section data sets by value.  Their addresses get registered to G4CrossSectionDataSetRegistry while the processes get registered to G4ProcessTable.  

If G4ProcessTable destroys first it will safely lead to the cross section data sets getting unregistered.  However, if the G4CrossSectionDataSetRegistry destroys first it will attempt to delete the nuclear processes' data sets which are allocated as part of the process object.

It is not possible (or at least not easy) to control which destroys first and at least on Mac and Linux with 4.9.2p01 it is the registry that wins (and my jobs that loose).

I think the simplest solution is to make the data sets be held by pointer and allocated on the heap and that the processes should not assume ownership (to avoid double delete).
Comment 1 Vladimir.Ivantchenko 2009-06-03 11:28:52 CEST
Hello,

The problem have been fixed and the fix is available with coming this week 9.3beta release of Geant4.

Vladimir