diff --git a/src/Keys.cc b/src/Keys.cc index ac255888..794aad48 100644 --- a/src/Keys.cc +++ b/src/Keys.cc @@ -35,6 +35,7 @@ #include "FbTk/CommandParser.hh" #include "FbTk/I18n.hh" #include "FbTk/AutoReloadHelper.hh" +#include "FbTk/STLUtil.hh" #ifdef HAVE_CONFIG_H #include "config.h" @@ -102,6 +103,8 @@ using std::vector; using std::ifstream; using std::pair; +using FbTk::STLUtil::destroyAndClearSecond; + // helper class 'keytree' class Keys::t_key { public: @@ -185,9 +188,8 @@ Keys::~Keys() { /// Destroys the keytree 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(); + + destroyAndClearSecond(m_map); next_key = 0; saved_keymode = 0; }