couple of memory fixes from valgrind

This commit is contained in:
simonb 2006-04-22 15:37:04 +00:00
parent 23cdfaaff3
commit 932eebe0dd
4 changed files with 9 additions and 5 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.16: Changes for 0.9.16:
*06/04/22: *06/04/22:
* Couple of memory-based fixes from valgrind (Simon)
Keys.cc Screen.cc MenuCreator.cc
* Applied #1467926 and #1458069, minor other changes (Mathias) * Applied #1467926 and #1458069, minor other changes (Mathias)
docs/asciidoc/fluxbox.txt docs/asciidoc/fluxbox.txt
* static CommandParser could be used after destruction (Simon) * static CommandParser could be used after destruction (Simon)

View file

@ -117,8 +117,8 @@ void Keys::deleteTree() {
delete *it; delete *it;
map_it->second->clear(); map_it->second->clear();
delete map_it->second; delete map_it->second;
m_map.erase(map_it->first);
} }
m_map.clear();
} }
/** /**
@ -343,7 +343,6 @@ bool Keys::doAction(XKeyEvent &ke) {
returns true on success else false returns true on success else false
*/ */
bool Keys::reconfigure(const char *filename) { bool Keys::reconfigure(const char *filename) {
deleteTree();
return load(filename); return load(filename);
} }

View file

@ -458,7 +458,7 @@ FbTk::Menu *MenuCreator::createMenuType(const std::string &type, int screen_num)
menu->disableTitle(); // not titlebar menu->disableTitle(); // not titlebar
if (screen->windowMenuFilename().empty() || if (screen->windowMenuFilename().empty() ||
! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) { ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) {
char default_menu[][11] = { char *default_menu[] = {
"shade", "shade",
"stick", "stick",
"maximize", "maximize",
@ -472,7 +472,7 @@ FbTk::Menu *MenuCreator::createMenuType(const std::string &type, int screen_num)
"close", "close",
0 0
}; };
for (unsigned int i=0; i < sizeof(default_menu); ++i) for (unsigned int i=0; default_menu[i]; ++i)
createWindowMenuItem(default_menu[i], "", *menu); createWindowMenuItem(default_menu[i], "", *menu);
} }
menu->reconfigure(); // update graphics menu->reconfigure(); // update graphics

View file

@ -345,8 +345,11 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
XSetErrorHandler((XErrorHandler) old); XSetErrorHandler((XErrorHandler) old);
managed = running; managed = running;
if (! managed) if (! managed) {
delete m_placement_strategy; m_placement_strategy = 0;
delete m_focus_control; m_focus_control = 0;
return; return;
}
// TODO fluxgen: check if this is the right place // TODO fluxgen: check if this is the right place
m_head_areas = new HeadArea[numHeads() ? numHeads() : 1]; m_head_areas = new HeadArea[numHeads() ? numHeads() : 1];