From c6099d777d844699fb8a4243921159898bc4f45c Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sat, 12 Jan 2008 17:49:50 -0800 Subject: fix crashes on restart --- src/Toolbar.cc | 3 ++- src/fluxbox.cc | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 89ba9cf..18f07fc 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -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) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 110123c..d45a45e 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -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(); } -- cgit v0.11.2