Problem 2461

Summary: Bug in G4UserTrackingAction::PostUserTrackingAction(const G4Track* track)
Product: Geant4 Reporter: Linmao Li <llm20>
Component: trackingAssignee: Takashi.Sasaki
Status: RESOLVED INVALID    
Severity: minor    
Priority: P4    
Version: 10.7   
Hardware: PC   
OS: All   
Attachments: The class I derived from G4UserTrackingAction
The definition of "PostUserTrackingAction(const G4Track*)"
The program crashed

Description Linmao Li 2022-01-05 07:43:06 CET
When a member function of "track" such as "track->GetCreatorProcess()" is called in "G4UserTrackingAction::PostUserTrackingAction(const G4Track* track)", i.e., "fpUserTrackingAction->PostUserTrackingAction(fpTrack);" in "G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)", a "segmentation fault" error will ocuur.
Comment 1 Takashi.Sasaki 2022-01-05 07:55:33 CET
UserTrackingAction is what you provided. Debug your code, please.
Comment 2 Linmao Li 2022-01-11 09:25:59 CET
Created attachment 744 [details]
The class I derived from G4UserTrackingAction

The header of the class I derived from G4UserTrackingAction
Comment 3 Linmao Li 2022-01-11 09:27:24 CET
Created attachment 745 [details]
The definition of "PostUserTrackingAction(const G4Track*)"
Comment 4 Linmao Li 2022-01-11 09:41:10 CET
Created attachment 746 [details]
The program crashed
Comment 5 Linmao Li 2022-01-11 09:43:34 CET
Maybe I didn't make it clear.

I created "class TrackingAction" derived from "G4UserTrackingAction".
Then I overrode the member function "virtual void PostUserTrackingAction(const G4Track*)", where I call the member functions of "G4Track", for example, "G4String creatorProcessName = track->GetCreatorProcess()->GetProcessName();"
Then the program crashed。

You can see the pictures I submitted.
Comment 6 Takashi.Sasaki 2022-01-11 09:47:38 CET
Please debug your program by yourself. I cannot afford to help you privately. We, developers, are unpaid volunteers.