From 19bc596b84b26f6c3022d05973ae514a50eeeea1 Mon Sep 17 00:00:00 2001 From: mathias Date: Sat, 20 Nov 2004 18:12:51 +0000 Subject: fix segfaults on restart/exit, still issues with former iconified windows at startup of fluxbox should close #1067582, #1067580, #1060912 --- src/Screen.cc | 26 +++++++++++++++++--------- src/fluxbox.cc | 16 ++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index da55b7e..9bb0e2d 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -408,9 +408,6 @@ BScreen::~BScreen() { // we need to destroy it before we destroy workspaces m_workspacemenu.reset(0); - // slit must be destroyed before headAreas (Struts) - m_slit.reset(0); - if (geom_pixmap != None) imageControl().removeImage(geom_pixmap); @@ -420,13 +417,28 @@ BScreen::~BScreen() { removeWorkspaceNames(); destroyAndClearList(m_workspaces_list); - destroyAndClearList(m_icon_list); destroyAndClearList(m_netizen_list); + //why not destroyAndClearList(m_icon_list); ? + //problem with that: a delete FluxboxWindow* calls m_diesig.notify() + //which leads to screen.removeWindow() which leads to removeIcon(win) + //which would modify the m_icon_list anyways... + Icons tmp; + tmp = m_icon_list; + while(!tmp.empty()) { + removeWindow(tmp.back()); + tmp.back()->restore(true); + delete (tmp.back()); + tmp.pop_back(); + } + if (hasXinerama() && m_xinerama_headinfo) { delete [] m_xinerama_headinfo; } + // slit must be destroyed before headAreas (Struts) + m_slit.reset(0); + // TODO fluxgen: check if this is the right place delete [] m_head_areas; } @@ -771,7 +783,7 @@ void BScreen::addIcon(FluxboxWindow *w) { void BScreen::removeIcon(FluxboxWindow *w) { if (w == 0) return; - + Icons::iterator erase_it = remove_if(getIconList().begin(), getIconList().end(), bind2nd(equal_to(), w)); @@ -1677,8 +1689,6 @@ void BScreen::initMenu() { } - - if (m_rootmenu.get() == 0) { _FB_USES_NLS; m_rootmenu.reset(createMenu(_FBTEXT(Menu, DefaultRootMenu, "Fluxbox default menu", "Title of fallback root menu"))); @@ -1841,7 +1851,6 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) { #endif // HAVE_XRENDER #undef _BOOLITEM - // finaly update menu menu.update(); } @@ -1854,7 +1863,6 @@ void BScreen::shutdown() { for_each(m_workspaces_list.begin(), m_workspaces_list.end(), mem_fun(&Workspace::shutdown)); - } diff --git a/src/fluxbox.cc b/src/fluxbox.cc index fb846e0..c87278f 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -465,6 +465,12 @@ Fluxbox::~Fluxbox() { delete m_toolbars.back(); m_toolbars.pop_back(); } + + // destroy screens + while (!m_screen_list.empty()) { + delete m_screen_list.back(); + m_screen_list.pop_back(); + } // destroy atomhandlers for (AtomHandlerContainerIt it= m_atomhandler.begin(); @@ -472,11 +478,7 @@ Fluxbox::~Fluxbox() { it++) { delete (*it).first; } - - while (!m_screen_list.empty()) { - delete m_screen_list.back(); - m_screen_list.pop_back(); - } + m_atomhandler.clear(); clearMenuFilenames(); } @@ -1159,11 +1161,13 @@ void Fluxbox::update(FbTk::Subject *changedsub) { (*it).first->updateLayer(win); } } else if ((&(win.dieSig())) == changedsub) { // window death signal + for (AtomHandlerContainerIt it= m_atomhandler.begin(); - it != m_atomhandler.end(); ++it) { + it != m_atomhandler.end(); ++it) { if ((*it).first->update()) (*it).first->updateFrameClose(win); } + // make sure each workspace get this BScreen &scr = win.screen(); scr.removeWindow(&win); -- cgit v0.11.2