fix an infinite loop in HandleOnNavigationKey() when wxUSE_STL==1 and start_node is NULL
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4b3feaa75d
commit
edc0a395c6
@ -302,7 +302,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
|
||||
}
|
||||
|
||||
// where are we going?
|
||||
bool forward = event.GetDirection();
|
||||
const bool forward = event.GetDirection();
|
||||
|
||||
// the node of the children list from which we should start looking for the
|
||||
// next acceptable child
|
||||
@ -319,11 +319,8 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
|
||||
|
||||
// start from first or last depending on where we're going
|
||||
node = forward ? children.GetFirst() : children.GetLast();
|
||||
|
||||
// we want to cycle over all nodes
|
||||
start_node = wxWindowList::compatibility_iterator();
|
||||
}
|
||||
else
|
||||
else // going up
|
||||
{
|
||||
// try to find the child which has the focus currently
|
||||
|
||||
@ -349,10 +346,6 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
|
||||
// ok, we found the focus - now is it our child?
|
||||
start_node = children.Find( winFocus );
|
||||
}
|
||||
else
|
||||
{
|
||||
start_node = wxWindowList::compatibility_iterator();
|
||||
}
|
||||
|
||||
if ( !start_node && m_winLastFocused )
|
||||
{
|
||||
@ -373,14 +366,18 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
|
||||
}
|
||||
|
||||
// we want to cycle over all elements passing by NULL
|
||||
while ( node != start_node )
|
||||
for ( ;; )
|
||||
{
|
||||
// don't go into infinite loop
|
||||
if ( start_node && node == start_node )
|
||||
break;
|
||||
|
||||
// Have we come to the last or first item on the panel?
|
||||
if ( !node )
|
||||
{
|
||||
if ( !goingDown )
|
||||
{
|
||||
// Check if our (may be grand) parent is another panel: if this
|
||||
// Check if our (maybe grand) parent is another panel: if this
|
||||
// is the case, they will know what to do with this navigation
|
||||
// key and so give them the chance to process it instead of
|
||||
// looping inside this panel (normally, the focus will go to
|
||||
|
Loading…
Reference in New Issue
Block a user