Fix possible race condition with capture loading

* The event browser called SetEventID from OnCaptureLoaded, which would then
  call OnEventChanged on all viewers, which if they kicked off work could happen
  at the same time as the later call to OpCaptureLoaded for them.
* In the mesh viewer this seemed to lead to a race condition and had a chance to
  corrupt memory.
This commit is contained in:
baldurk
2018-07-13 13:05:32 +01:00
parent 71c104761a
commit 10b82e6255
2 changed files with 5 additions and 4 deletions
+5 -2
View File
@@ -194,9 +194,9 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFi
// make sure we're on a consistent event before invoking viewer forms
if(m_LastDrawcall)
SetEventID(viewers, m_LastDrawcall->eventId, true);
SetEventID(viewers, m_LastDrawcall->eventId, m_LastDrawcall->eventId, true);
else if(!m_Drawcalls->empty())
SetEventID(viewers, m_Drawcalls->back().eventId, true);
SetEventID(viewers, m_Drawcalls->back().eventId, m_Drawcalls->back().eventId, true);
GUIInvoke::blockcall(m_MainWindow, [&viewers]() {
// notify all the registers viewers that a capture has been loaded
@@ -213,6 +213,9 @@ void CaptureContext::LoadCapture(const rdcstr &captureFile, const rdcstr &origFi
ShowCommentView();
RaiseDockWindow(GetCommentView()->Widget());
}
// refresh the UI without forcing the replay
SetEventID({}, m_SelectedEventID, m_EventID, false);
}
}
-2
View File
@@ -252,8 +252,6 @@ void EventBrowser::OnCaptureLoaded()
ui->exportDraws->setEnabled(true);
ui->stepPrev->setEnabled(true);
ui->stepNext->setEnabled(true);
m_Ctx.SetEventID({this}, lastEIDDraw.first, lastEIDDraw.first);
}
void EventBrowser::OnCaptureClosed()