Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix G4VExceptionHandler lifetime and improve exception wrapping #773

Merged
merged 9 commits into from
May 30, 2023

Conversation

sethrj
Copy link
Member

@sethrj sethrj commented May 24, 2023

Because G4VExceptionHandler permanently saves a pointer to itself, calling G4Exception after GeantExceptionHandler exited scope would cause the code to segfault. A new public wrapper class ScopedGeantExceptionHandler, which is safe to use even if Geant4 is disabled, should correctly save and restore the original exception handler to prevent this from occurring.

While testing #759 I also hit some exceptions inside the transport loop in the step collector tests, so I unified the stepper loops in those and wrapped with LogKernelException.

@sethrj sethrj added bug Something isn't working external Dependencies and framework-oriented features labels May 24, 2023
@sethrj sethrj requested a review from amandalund May 24, 2023 15:40
@sethrj sethrj requested review from pcanal and removed request for amandalund May 26, 2023 20:26
test/celeritas/GlobalTestBase.cc Show resolved Hide resolved
test/celeritas/GlobalTestBase.cc Outdated Show resolved Hide resolved
@sethrj sethrj requested a review from pcanal May 30, 2023 15:21
@sethrj
Copy link
Member Author

sethrj commented May 30, 2023

Thanks @pcanal !

@sethrj sethrj merged commit c61064c into celeritas-project:develop May 30, 2023
@sethrj sethrj deleted the geant-scoped-exception branch May 31, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Dependencies and framework-oriented features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants