fix segfaults on restart/exit, still issues with former iconified windows

at startup of fluxbox

should close #1067582, #1067580, #1060912
This commit is contained in:
mathias 2004-11-20 18:12:51 +00:00
parent e5b5984eca
commit 19bc596b84
2 changed files with 27 additions and 15 deletions

View file

@ -408,9 +408,6 @@ BScreen::~BScreen() {
// we need to destroy it before we destroy workspaces // we need to destroy it before we destroy workspaces
m_workspacemenu.reset(0); m_workspacemenu.reset(0);
// slit must be destroyed before headAreas (Struts)
m_slit.reset(0);
if (geom_pixmap != None) if (geom_pixmap != None)
imageControl().removeImage(geom_pixmap); imageControl().removeImage(geom_pixmap);
@ -420,13 +417,28 @@ BScreen::~BScreen() {
removeWorkspaceNames(); removeWorkspaceNames();
destroyAndClearList(m_workspaces_list); destroyAndClearList(m_workspaces_list);
destroyAndClearList(m_icon_list);
destroyAndClearList(m_netizen_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) { if (hasXinerama() && m_xinerama_headinfo) {
delete [] 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 // TODO fluxgen: check if this is the right place
delete [] m_head_areas; delete [] m_head_areas;
} }
@ -771,7 +783,7 @@ void BScreen::addIcon(FluxboxWindow *w) {
void BScreen::removeIcon(FluxboxWindow *w) { void BScreen::removeIcon(FluxboxWindow *w) {
if (w == 0) if (w == 0)
return; return;
Icons::iterator erase_it = remove_if(getIconList().begin(), Icons::iterator erase_it = remove_if(getIconList().begin(),
getIconList().end(), getIconList().end(),
bind2nd(equal_to<FluxboxWindow *>(), w)); bind2nd(equal_to<FluxboxWindow *>(), w));
@ -1677,8 +1689,6 @@ void BScreen::initMenu() {
} }
if (m_rootmenu.get() == 0) { if (m_rootmenu.get() == 0) {
_FB_USES_NLS; _FB_USES_NLS;
m_rootmenu.reset(createMenu(_FBTEXT(Menu, DefaultRootMenu, "Fluxbox default menu", "Title of fallback root menu"))); 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 #endif // HAVE_XRENDER
#undef _BOOLITEM #undef _BOOLITEM
// finaly update menu // finaly update menu
menu.update(); menu.update();
} }
@ -1854,7 +1863,6 @@ void BScreen::shutdown() {
for_each(m_workspaces_list.begin(), for_each(m_workspaces_list.begin(),
m_workspaces_list.end(), m_workspaces_list.end(),
mem_fun(&Workspace::shutdown)); mem_fun(&Workspace::shutdown));
} }

View file

@ -465,6 +465,12 @@ Fluxbox::~Fluxbox() {
delete m_toolbars.back(); delete m_toolbars.back();
m_toolbars.pop_back(); m_toolbars.pop_back();
} }
// destroy screens
while (!m_screen_list.empty()) {
delete m_screen_list.back();
m_screen_list.pop_back();
}
// destroy atomhandlers // destroy atomhandlers
for (AtomHandlerContainerIt it= m_atomhandler.begin(); for (AtomHandlerContainerIt it= m_atomhandler.begin();
@ -472,11 +478,7 @@ Fluxbox::~Fluxbox() {
it++) { it++) {
delete (*it).first; delete (*it).first;
} }
m_atomhandler.clear();
while (!m_screen_list.empty()) {
delete m_screen_list.back();
m_screen_list.pop_back();
}
clearMenuFilenames(); clearMenuFilenames();
} }
@ -1159,11 +1161,13 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
(*it).first->updateLayer(win); (*it).first->updateLayer(win);
} }
} else if ((&(win.dieSig())) == changedsub) { // window death signal } else if ((&(win.dieSig())) == changedsub) { // window death signal
for (AtomHandlerContainerIt it= m_atomhandler.begin(); for (AtomHandlerContainerIt it= m_atomhandler.begin();
it != m_atomhandler.end(); ++it) { it != m_atomhandler.end(); ++it) {
if ((*it).first->update()) if ((*it).first->update())
(*it).first->updateFrameClose(win); (*it).first->updateFrameClose(win);
} }
// make sure each workspace get this // make sure each workspace get this
BScreen &scr = win.screen(); BScreen &scr = win.screen();
scr.removeWindow(&win); scr.removeWindow(&win);