From: Jaakko Salli Date: Mon, 14 Sep 2009 14:53:13 +0000 (+0000) Subject: Fixed use of map::erase() in ClearActionTriggers() (this bug was revealed by static... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/36a2b429aece7f4466b666d42c0c10a45295a688?ds=inline Fixed use of map::erase() in ClearActionTriggers() (this bug was revealed by static code analysis - see ticket #11195) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index fcad2acd94..4eb8520799 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5232,14 +5232,25 @@ void wxPropertyGrid::AddActionTrigger( int action, int keycode, int modifiers ) void wxPropertyGrid::ClearActionTriggers( int action ) { wxPGHashMapI2I::iterator it; + bool didSomething; - for ( it = m_actionTriggers.begin(); it != m_actionTriggers.end(); ++it ) + do { - if ( it->second == action ) + didSomething = false; + + for ( it = m_actionTriggers.begin(); + it != m_actionTriggers.end(); + it++ ) { - m_actionTriggers.erase(it); + if ( it->second == action ) + { + m_actionTriggers.erase(it); + didSomething = true; + break; + } } } + while ( didSomething ); } void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )