Skip to content

Safety of calling sentry_close(); in on_crash_callback #1055

Answered by supervacuus
conde2 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @conde2!

Its working but I'm not sure if this can cause some problem.

Yes, it can cause problems, particularly on Linux, where the on_crash hook is executed from the signal handler. We documented this here:

In your example, you "close" the SDK and then proceed to run the crash handler, which would require a non-closed SDK. You would have to free the event and return a null value as described in the docs: https://docs.sentry.io/platforms/native/configuration/filtering/#using-on_crash.

But even then, sentry_capture_event() and sentry_close() would call a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@conde2
Comment options

Answer selected by conde2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #1054 on October 21, 2024 08:33.