Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Inproc: build vendored libunwind for 32-bit ARM on Linux. ([#1659](https://github.com/getsentry/sentry-native/issues/1659))
- Native: build for 64-bit ARM on Linux with musl. ([#1665](https://github.com/getsentry/sentry-native/pull/1665))
- Native/Linux: prevent shared memory leak on crash. ([#1664](https://github.com/getsentry/sentry-native/pull/1664))
- Native: skip scope flush during crash handling. ([#1668](https://github.com/getsentry/sentry-native/pull/1668))

## 0.13.7

Expand Down
11 changes: 7 additions & 4 deletions src/backends/sentry_backend_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ typedef struct {
sentry_path_t *breadcrumb2_path;
sentry_path_t *envelope_path;
size_t num_breadcrumbs;
volatile long crashed;
} native_backend_state_t;

static int
Expand Down Expand Up @@ -570,7 +571,7 @@ native_backend_flush_scope(
sentry_backend_t *backend, const sentry_options_t *UNUSED(options))
{
native_backend_state_t *state = (native_backend_state_t *)backend->data;
if (!state || !state->event_path) {
if (!state || !state->event_path || sentry__atomic_fetch(&state->crashed)) {
return;
}

Expand Down Expand Up @@ -804,6 +805,11 @@ native_backend_add_attachment(
static void
native_backend_except(sentry_backend_t *backend, const sentry_ucontext_t *uctx)
{
native_backend_state_t *state = (native_backend_state_t *)backend->data;
if (state) {
sentry__atomic_store(&state->crashed, 1);
}

SENTRY_WITH_OPTIONS (options) {
// Disable logging during crash handling if configured
if (!options->enable_logging_when_crashed) {
Expand Down Expand Up @@ -840,9 +846,6 @@ native_backend_except(sentry_backend_t *backend, const sentry_ucontext_t *uctx)
}

if (should_handle) {
native_backend_state_t *state
= (native_backend_state_t *)backend->data;

// Apply before_send hook if on_crash wasn't set
if (!options->on_crash_func && options->before_send_func) {
SENTRY_DEBUG("invoking `before_send` hook");
Expand Down
Loading