Fix potential race when destroying windows while command is in flight

This commit is contained in:
baldurk
2023-05-08 13:46:13 +01:00
parent 5b81eff759
commit 9a21a66f7c
+8 -2
View File
@@ -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<std::remove_reference<decltype(*this)>::type> meptr; \
m_Ctx.Replay().AsyncInvoke([meptr](IReplayController *r) { \
if(meptr) \
meptr->function(r); \
}); \
}