mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-14 00:09:24 +01:00
Fix crash when pressing Tab
When pressing Tab for a long time, Dolphin will sooner or later crash because the result of FindFocus() has become NULL (toctou).
This commit is contained in:
parent
4f3227b4a9
commit
296637d6f2
@ -706,13 +706,16 @@ bool CFrame::RendererHasFocus()
|
|||||||
if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
|
if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if (wxWindow::FindFocus() == nullptr)
|
wxWindow *window = wxWindow::FindFocus();
|
||||||
|
if (window == nullptr)
|
||||||
return false;
|
return false;
|
||||||
// Why these different cases?
|
// Why these different cases?
|
||||||
if (m_RenderParent == wxWindow::FindFocus() ||
|
if (m_RenderParent == window ||
|
||||||
m_RenderParent == wxWindow::FindFocus()->GetParent() ||
|
m_RenderParent == window->GetParent() ||
|
||||||
m_RenderParent->GetParent() == wxWindow::FindFocus()->GetParent())
|
m_RenderParent->GetParent() == window->GetParent())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user