moved destroyAndClearList from Screen.cc to STLUtil::destroyAndClear
This commit is contained in:
parent
36f5a46fd7
commit
806addad8e
1 changed files with 7 additions and 14 deletions
|
@ -36,6 +36,8 @@
|
||||||
#include "FocusControl.hh"
|
#include "FocusControl.hh"
|
||||||
#include "ScreenPlacement.hh"
|
#include "ScreenPlacement.hh"
|
||||||
|
|
||||||
|
#include "STLUtil.hh"
|
||||||
|
|
||||||
// themes
|
// themes
|
||||||
#include "FbWinFrameTheme.hh"
|
#include "FbWinFrameTheme.hh"
|
||||||
#include "MenuTheme.hh"
|
#include "MenuTheme.hh"
|
||||||
|
@ -463,16 +465,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||||
XFlush(disp);
|
XFlush(disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename A>
|
|
||||||
void destroyAndClearList(A &a) {
|
|
||||||
typedef typename A::iterator iterator;
|
|
||||||
iterator it = a.begin();
|
|
||||||
iterator it_end = a.end();
|
|
||||||
for (; it != it_end; ++it)
|
|
||||||
delete (*it);
|
|
||||||
|
|
||||||
a.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
BScreen::~BScreen() {
|
BScreen::~BScreen() {
|
||||||
|
|
||||||
|
@ -512,12 +505,12 @@ BScreen::~BScreen() {
|
||||||
imageControl().removeImage(pos_pixmap);
|
imageControl().removeImage(pos_pixmap);
|
||||||
|
|
||||||
removeWorkspaceNames();
|
removeWorkspaceNames();
|
||||||
|
using namespace STLUtil;
|
||||||
|
destroyAndClear(m_workspaces_list);
|
||||||
|
destroyAndClear(m_netizen_list);
|
||||||
|
destroyAndClear(m_managed_resources);
|
||||||
|
|
||||||
destroyAndClearList(m_workspaces_list);
|
//why not destroyAndClear(m_icon_list); ?
|
||||||
destroyAndClearList(m_netizen_list);
|
|
||||||
destroyAndClearList(m_managed_resources);
|
|
||||||
|
|
||||||
//why not destroyAndClearList(m_icon_list); ?
|
|
||||||
//problem with that: a delete FluxboxWindow* calls m_diesig.notify()
|
//problem with that: a delete FluxboxWindow* calls m_diesig.notify()
|
||||||
//which leads to screen.removeWindow() which leads to removeIcon(win)
|
//which leads to screen.removeWindow() which leads to removeIcon(win)
|
||||||
//which would modify the m_icon_list anyways...
|
//which would modify the m_icon_list anyways...
|
||||||
|
|
Loading…
Reference in a new issue