fix crashes on restart

This commit is contained in:
Mark Tiefenbruck 2008-01-12 17:49:50 -08:00
parent 5b7bde2ffb
commit c6099d777d
2 changed files with 9 additions and 9 deletions

View file

@ -287,7 +287,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
}
Toolbar::~Toolbar() {
Fluxbox::instance()->keys()->unregisterWindow(window().window());
if (Fluxbox::instance()->keys())
Fluxbox::instance()->keys()->unregisterWindow(window().window());
FbTk::EventManager::instance()->remove(window());
// remove menu items before we delete tools so we dont end up
// with dangling pointers to old submenu items (internal menus)

View file

@ -420,14 +420,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
Fluxbox::~Fluxbox() {
// destroy atomhandlers
for (AtomHandlerContainerIt it= m_atomhandler.begin();
it != m_atomhandler.end();
it++) {
delete (*it).first;
}
m_atomhandler.clear();
// this needs to be destroyed before screens; otherwise, menus stored in
// key commands cause a segfault when the XLayerItem is destroyed
m_key.reset(0);
@ -438,6 +430,13 @@ Fluxbox::~Fluxbox() {
m_screen_list.pop_back();
}
// destroy atomhandlers
for (AtomHandlerContainerIt it= m_atomhandler.begin();
it != m_atomhandler.end();
it++) {
delete (*it).first;
}
m_atomhandler.clear();
clearMenuFilenames();
}