Skip to content

Commit ac104ed

Browse files
committed
Fix async callback race condition
1 parent 8c560c6 commit ac104ed

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ private void onChunkCollected(
379379

380380
if (shouldRestart) {
381381
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
382-
if (isRunning) {
382+
if (isRunning || isClosed.get()) {
383383
logger.log(
384384
SentryLevel.DEBUG,
385-
"Profile chunk finished, but profiler was already restarted. Skipping.");
385+
"Profile chunk finished, but profiler was already restarted or closed. Skipping.");
386386
return;
387387
}
388388
logger.log(SentryLevel.DEBUG, "Profile chunk finished. Starting a new one.");

0 commit comments

Comments
 (0)