Merge pull request #92 from Tilka/tab_crash

Fix crash when pressing Tab
This commit is contained in:
Pierre Bourdon 2014-04-14 10:46:07 +02:00
commit c614a707ab
1 changed files with 7 additions and 4 deletions

View File

@ -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;
} }