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:
Tomas Janousek 2008-02-04 18:33:17 +01:00
parent 9671b2f99c
commit b61502ffbc
2 changed files with 5 additions and 2 deletions

View file

@ -168,7 +168,7 @@ Keys::t_key::~t_key() {
Keys::Keys() { }
Keys::Keys() : next_key(0) { }
Keys::~Keys() {
ungrabKeys();
@ -181,6 +181,7 @@ void Keys::deleteTree() {
for (keyspace_t::iterator map_it = m_map.begin(); map_it != m_map.end(); ++map_it)
delete map_it->second;
m_map.clear();
next_key = 0;
}
// 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;
}
static t_key* next_key = m_keylist;
if (!next_key)
next_key = m_keylist;

View file

@ -113,6 +113,9 @@ private:
t_key *m_keylist;
keyspace_t m_map;
// former doAction static var, we need to access it from deleteTree
t_key *next_key;
WindowMap m_window_map;
HandlerMap m_handler_map;
};