Skip to content

Commit

Permalink
fix(ndk): remove possibility the the bsg_global_env->handling_crash
Browse files Browse the repository at this point in the history
… or `unwinding_crash_stack` CAS succeed spuriously
  • Loading branch information
lemnik committed Jan 8, 2024
1 parent ba43ff7 commit 6fb06dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bugsnag-plugin-android-ndk/src/main/jni/bugsnag_ndk.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool bsg_run_on_error() {
}

bool bsg_begin_handling_crash() {
static bool expected = false;
bool expected = false;
return atomic_compare_exchange_strong(&bsg_global_env->handling_crash,
&expected, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ssize_t bsg_unwind_crash_stack(bugsnag_stackframe stack[BUGSNAG_FRAMES_MAX],
// we always check unwinding_crash_stack and set *before* attempting to
// retrieve the crash unwinder to avoid picking up an unwinder that is about
// to be destroyed by bsg_unwinder_refresh
static bool expected = false;
bool expected = false;
if (!std::atomic_compare_exchange_strong(&unwinding_crash_stack, &expected,
true)) {
return 0;
Expand Down

0 comments on commit 6fb06dc

Please sign in to comment.