From 806addad8e1220cbf9ab5228e662f24e4f3dcd52 Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Sat, 13 May 2006 15:35:47 +0000
Subject: moved destroyAndClearList from Screen.cc to STLUtil::destroyAndClear

---
 src/Screen.cc | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/Screen.cc b/src/Screen.cc
index 626b296..715411c 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -36,6 +36,8 @@
 #include "FocusControl.hh"
 #include "ScreenPlacement.hh"
 
+#include "STLUtil.hh"
+
 // themes
 #include "FbWinFrameTheme.hh"
 #include "MenuTheme.hh"
@@ -463,16 +465,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
     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() {
     
@@ -512,12 +505,12 @@ BScreen::~BScreen() {
         imageControl().removeImage(pos_pixmap);
 
     removeWorkspaceNames();
+    using namespace STLUtil;
+    destroyAndClear(m_workspaces_list);
+    destroyAndClear(m_netizen_list);
+    destroyAndClear(m_managed_resources);
 
-    destroyAndClearList(m_workspaces_list);
-    destroyAndClearList(m_netizen_list);
-    destroyAndClearList(m_managed_resources);
-
-    //why not destroyAndClearList(m_icon_list); ? 
+    //why not destroyAndClear(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...
-- 
cgit v0.11.2