mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
GUIInvoke takes a QObject* to avoid callbacks after object lifetime
* The GUIInvoke object takes a QObject, and uses QPointer to check that it hasn't been deleted when the callback fires. This prevents delayed callbacks from executing after the object has been deleted and crashing. * In most cases the pointer is just 'this'.
This commit is contained in:
@@ -193,7 +193,7 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFi
|
||||
else if(!m_Drawcalls.empty())
|
||||
SetEventID(viewers, m_Drawcalls.back().eventId, true);
|
||||
|
||||
GUIInvoke::blockcall([&viewers]() {
|
||||
GUIInvoke::blockcall(m_MainWindow, [&viewers]() {
|
||||
// notify all the registers viewers that a capture has been loaded
|
||||
for(ICaptureViewer *viewer : viewers)
|
||||
{
|
||||
@@ -1062,7 +1062,7 @@ void CaptureContext::AddMessages(const rdcarray<DebugMessage> &msgs)
|
||||
|
||||
if(m_DebugMessageView)
|
||||
{
|
||||
GUIInvoke::call([this]() { m_DebugMessageView->RefreshMessageList(); });
|
||||
GUIInvoke::call(m_DebugMessageView, [this]() { m_DebugMessageView->RefreshMessageList(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user