all repos — fluxbox @ b61502ffbc17d51506bb274472f9bf8934319364

custom fork of the fluxbox windowmanager

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>
Tomas Janousek tomi@nomi.cz
commit

b61502ffbc17d51506bb274472f9bf8934319364

parent

9671b2f99cf42fcd1d610385836ffc79502d717a

2 files changed, 5 insertions(+), 2 deletions(-)

jump to
M src/Keys.ccsrc/Keys.cc

@@ -168,7 +168,7 @@ }

-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 @@ last_button = key;

isdouble = double_click; } - static t_key* next_key = m_keylist; if (!next_key) next_key = m_keylist;
M src/Keys.hhsrc/Keys.hh

@@ -113,6 +113,9 @@ std::string m_filename;

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; };