Problem 1991 - G4IStore::GetImportance() crashes with null G4VPhysicalVolume
Summary: G4IStore::GetImportance() crashes with null G4VPhysicalVolume
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/biasing (show other problems)
Version: 10.3
Hardware: All All
: P4 normal
Assignee: alexander.howard
URL:
Depends on:
Blocks:
 
Reported: 2017-07-11 23:42 CEST by mstoeckl
Modified: 2023-11-21 21:38 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description mstoeckl 2017-07-11 23:42:16 CEST
The biasing process G4ImportanceBiasing can end up calling
G4IStore::GetImportance with a null physical volume; this 
causes a crash because one cannot add a null G4VPhysicalVolume
to the store.

G4ImportanceProcess::PostStepDoIt will call G4IStore::GetImportance
with a G4GeometryCell constructed from the pre/post point volumes
of a G4Step; and the G4SteppingManager uses a null volume
to signify a point being on the world boundary.

[The fix involving the least lines of code: default G4IStore::GetImportance
to 1./world volume importance when the volume is null. Alternatively,
test for a null volume in everything that might run after hitting the world boundary error messages, as they crash when trying to access properties 
of the null volume, for instance the G4IStore::GetImportance error message. 
Alternatively, constrain when the biasing is run to not happen
on exiting the world volume.]
Comment 1 alexander.howard 2023-11-21 16:40:05 CET
https://geant4-forum.web.cern.ch/t/g4istore-getimportance-crashes-with-null-g4vphysicalvolume/11132
Finds this problem manifested if a volume is placed outside of the world volume. Giving an anonymous segmentation fault is equally unhelpful, therefore a check should be introduced to throw a more controlled G4Exception instead. Will be added to the fix.
Comment 2 alexander.howard 2023-11-21 21:38:36 CET
I couldn't reproduce a crash for this, however, I can see the hazard of accessing the pointer to the PostStep volume, therefore I have returned no change if the next volume is null. Will be included in release v11.2.