Fix a freed memory access in Keys::doAction.
The thing next_key pointed to was getting freed in deleteTree. Signed-off-by: Tomas Janousek <tomi@nomi.cz>
This commit is contained in:
parent
9671b2f99c
commit
b61502ffbc
2 changed files with 5 additions and 2 deletions
|
@ -168,7 +168,7 @@ Keys::t_key::~t_key() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Keys::Keys() { }
|
Keys::Keys() : next_key(0) { }
|
||||||
|
|
||||||
Keys::~Keys() {
|
Keys::~Keys() {
|
||||||
ungrabKeys();
|
ungrabKeys();
|
||||||
|
@ -181,6 +181,7 @@ void Keys::deleteTree() {
|
||||||
for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it)
|
for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it)
|
||||||
delete map_it->second;
|
delete map_it->second;
|
||||||
m_map.clear();
|
m_map.clear();
|
||||||
|
next_key = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// keys are only grabbed in global context
|
// keys are only grabbed in global context
|
||||||
|
@ -502,7 +503,6 @@ bool Keys::doAction(int type, unsigned int mods, unsigned int key,
|
||||||
isdouble = double_click;
|
isdouble = double_click;
|
||||||
}
|
}
|
||||||
|
|
||||||
static t_key* next_key = m_keylist;
|
|
||||||
if (!next_key)
|
if (!next_key)
|
||||||
next_key = m_keylist;
|
next_key = m_keylist;
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,9 @@ private:
|
||||||
t_key *m_keylist;
|
t_key *m_keylist;
|
||||||
keyspace_t m_map;
|
keyspace_t m_map;
|
||||||
|
|
||||||
|
// former doAction static var, we need to access it from deleteTree
|
||||||
|
t_key *next_key;
|
||||||
|
|
||||||
WindowMap m_window_map;
|
WindowMap m_window_map;
|
||||||
HandlerMap m_handler_map;
|
HandlerMap m_handler_map;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue