From 1f4e83986e0ffb3562e8508285f9199780ae3ec9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 May 2023 13:48:06 +0100 Subject: [PATCH] Potential fix for Android thread race condition * Synchronous commands are on the stack, so incrementing the done flag should be the last thing we do to interact with them. That includes checking for self- deletion afterwards --- renderdoc/android/android.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/renderdoc/android/android.cpp b/renderdoc/android/android.cpp index f3ee3b23a..ff295fdae 100644 --- a/renderdoc/android/android.cpp +++ b/renderdoc/android/android.cpp @@ -894,10 +894,14 @@ struct AndroidController : public IDeviceProtocolHandler cmd->meth(); - Atomic::Inc32(&cmd->done); - if(cmd->selfdelete) + { delete cmd; + } + else + { + Atomic::Inc32(&cmd->done); + } } }