From 9a21a66f7c8fa8d6981cfd2d0e9b1456ccdda01e Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 8 May 2023 13:46:13 +0100 Subject: [PATCH] Fix potential race when destroying windows while command is in flight --- qrenderdoc/Code/Interface/QRDInterface.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index 39be7fab8..9558d69cb 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -2752,5 +2752,11 @@ data. rdcstr ConfigFilePath(const rdcstr &filename); // simple helper for the common case of 'we just need to run this on the replay thread' -#define INVOKE_MEMFN(function) \ - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { function(r); }); +#define INVOKE_MEMFN(function) \ + { \ + QPointer::type> meptr; \ + m_Ctx.Replay().AsyncInvoke([meptr](IReplayController *r) { \ + if(meptr) \ + meptr->function(r); \ + }); \ + }