summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Frame.cpp
diff options
context:
space:
mode:
authorTillmann Karras <tilkax@gmail.com>2014-02-22 21:08:20 +0100
committerTillmann Karras <tilkax@gmail.com>2014-04-14 10:27:41 +0200
commit296637d6f2f7be38f6f7ada56abc9d4df5740e50 (patch)
tree6119d33cd063a2703d79102769a6be58400b6f6c /Source/Core/DolphinWX/Frame.cpp
parent4f3227b4a94de2e149ce90edaaea40cc83b3c41a (diff)
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).
Diffstat (limited to 'Source/Core/DolphinWX/Frame.cpp')
-rw-r--r--Source/Core/DolphinWX/Frame.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index c7134167cf..87fb799616 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -706,13 +706,16 @@ bool CFrame::RendererHasFocus()
if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow())
return true;
#else
- if (wxWindow::FindFocus() == nullptr)
+ wxWindow *window = wxWindow::FindFocus();
+ if (window == nullptr)
return false;
// Why these different cases?
- if (m_RenderParent == wxWindow::FindFocus() ||
- m_RenderParent == wxWindow::FindFocus()->GetParent() ||
- m_RenderParent->GetParent() == wxWindow::FindFocus()->GetParent())
+ if (m_RenderParent == window ||
+ m_RenderParent == window->GetParent() ||
+ m_RenderParent->GetParent() == window->GetParent())
+ {
return true;
+ }
#endif
return false;
}