Fixed: Bug with C++11 under Linux with clang (an iterator is invalidated after an erase)
This commit is contained in:
parent
30545b8f7c
commit
e1549eb73c
1 changed files with 21 additions and 2 deletions
|
@ -148,9 +148,16 @@ void CActionsManager::removeCombo (const CCombo &combo)
|
||||||
while ((ite != _KeyAction.end ()) && (ite->first == combo.Key))
|
while ((ite != _KeyAction.end ()) && (ite->first == combo.Key))
|
||||||
{
|
{
|
||||||
TKeyActionMap::iterator copyToDelete = ite;
|
TKeyActionMap::iterator copyToDelete = ite;
|
||||||
ite++;
|
#ifdef NL_ISO_CPP0X_AVAILABLE
|
||||||
|
if (copyToDelete->second == oldName)
|
||||||
|
ite = _KeyAction.erase (copyToDelete);
|
||||||
|
else
|
||||||
|
++ite;
|
||||||
|
#else
|
||||||
|
++ite;
|
||||||
if (copyToDelete->second == oldName)
|
if (copyToDelete->second == oldName)
|
||||||
_KeyAction.erase (copyToDelete);
|
_KeyAction.erase (copyToDelete);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the action
|
// Remove the action
|
||||||
|
@ -320,7 +327,7 @@ void CActionsManager::keyReleased (const CEventKeyUp &keyUp)
|
||||||
TKeyActionMap::iterator iteWatchedAction = _WatchedActions.begin ();
|
TKeyActionMap::iterator iteWatchedAction = _WatchedActions.begin ();
|
||||||
while (iteWatchedAction != _WatchedActions.end ())
|
while (iteWatchedAction != _WatchedActions.end ())
|
||||||
{
|
{
|
||||||
TKeyActionMap::iterator iteToDelete = iteWatchedAction++;
|
TKeyActionMap::iterator iteToDelete = iteWatchedAction;
|
||||||
|
|
||||||
// Get the combo for this action
|
// Get the combo for this action
|
||||||
TActionComboMap::iterator iteCombo = _ActionCombo.find (iteToDelete->second);
|
TActionComboMap::iterator iteCombo = _ActionCombo.find (iteToDelete->second);
|
||||||
|
@ -334,7 +341,15 @@ void CActionsManager::keyReleased (const CEventKeyUp &keyUp)
|
||||||
nlassert (iteAction != _Actions.end());
|
nlassert (iteAction != _Actions.end());
|
||||||
|
|
||||||
// Remove this action from watching
|
// Remove this action from watching
|
||||||
|
#ifdef NL_ISO_CPP0X_AVAILABLE
|
||||||
|
// C++11 return the next item
|
||||||
|
iteWatchedAction = _WatchedActions.erase (iteToDelete);
|
||||||
|
#else
|
||||||
|
// remember the next iterator only if not using C++11
|
||||||
|
++iteWatchedAction;
|
||||||
|
|
||||||
_WatchedActions.erase (iteToDelete);
|
_WatchedActions.erase (iteToDelete);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Invalidate the action
|
// Invalidate the action
|
||||||
bool LastValid = iteAction->second.Valide;
|
bool LastValid = iteAction->second.Valide;
|
||||||
|
@ -349,6 +364,10 @@ void CActionsManager::keyReleased (const CEventKeyUp &keyUp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++iteWatchedAction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue