From 1295f134eda53ba87445e227472d6813c924e313 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Nov 2006 14:01:39 +0000 Subject: [PATCH] fixed crash due to infinite recursion in wxPopupFocusHandler::OnKeyDown() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/popupcmn.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 143dff2635..8fc32bcc50 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -34,6 +34,8 @@ #include "wx/log.h" #endif //WX_PRECOMP +#include "wx/recguard.h" + #ifdef __WXUNIVERSAL__ #include "wx/univ/renderer.h" #include "wx/scrolbar.h" @@ -561,6 +563,16 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event) void wxPopupFocusHandler::OnKeyDown(wxKeyEvent& event) { + // we can be associated with the popup itself in which case we should avoid + // infinite recursion + static int s_inside; + wxRecursionGuard guard(s_inside); + if ( guard.IsInside() ) + { + event.Skip(); + return; + } + // let the window have it first, it might process the keys if ( !m_popup->GetEventHandler()->ProcessEvent(event) ) { -- 2.45.2