Handle the case where the active window gets removed leaving us stuck

* When multiple windows are around if the active window gets removed
  we need to be careful when reassigning the active window.
This commit is contained in:
baldurk
2015-05-22 21:47:41 +02:00
parent 346ce0a778
commit 032700d0df
+10 -1
View File
@@ -825,9 +825,18 @@ void RenderDoc::RemoveFrameCapturer(void *dev, void *wnd)
if(m_ActiveWindow == dw)
{
if(m_WindowFrameCapturers.size() == 1)
{
m_ActiveWindow = DeviceWnd();
}
else
m_ActiveWindow = m_WindowFrameCapturers.begin()->first;
{
auto it = m_WindowFrameCapturers.begin();
// active window could be the first in our list, move
// to second (we know from above there are at least 2)
if(m_ActiveWindow == it->first)
it++;
m_ActiveWindow = it->first;
}
}
m_WindowFrameCapturers.erase(it);