Fix memory corruption.

This commit is contained in:
Christian Speckner 2019-05-26 00:31:47 +02:00
parent 9ea265859a
commit 97dfbd9fe8
1 changed files with 12 additions and 6 deletions

View File

@ -149,17 +149,23 @@ string KeyMap::getDesc(const int mode, const int key, const int mod) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::eraseMode(const int mode)
{
for (auto item : myMap)
if (item.first.mode == mode)
erase(item.first);
for (auto i = myMap.begin(); i != myMap.end();)
if (i->first.mode == mode) {
auto _i = i++;
erase(_i->first);
}
else i++;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::eraseEvent(const Event::Type event, const int mode)
{
for (auto item : myMap)
if (item.second == event && item.first.mode == mode)
erase(item.first);
for (auto i = myMap.begin(); i != myMap.end();)
if (i->second == event && i->first.mode == mode) {
auto _i = i++;
erase(_i->first);
}
else i++;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -