diff options
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 319852c..8c93a7b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Screen.cc,v 1.267 2004/02/20 09:06:19 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.268 2004/02/27 12:32:54 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -641,6 +641,17 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
641 | XFlush(disp); | 641 | XFlush(disp); |
642 | } | 642 | } |
643 | 643 | ||
644 | template <typename A> | ||
645 | void destroyAndClearList(A &a) { | ||
646 | typedef typename A::iterator iterator; | ||
647 | iterator it = a.begin(); | ||
648 | iterator it_end = a.end(); | ||
649 | for (; it != it_end; ++it) | ||
650 | delete (*it); | ||
651 | |||
652 | a.clear(); | ||
653 | } | ||
654 | |||
644 | BScreen::~BScreen() { | 655 | BScreen::~BScreen() { |
645 | if (! managed) | 656 | if (! managed) |
646 | return; | 657 | return; |
@@ -656,27 +667,9 @@ BScreen::~BScreen() { | |||
656 | 667 | ||
657 | removeWorkspaceNames(); | 668 | removeWorkspaceNames(); |
658 | 669 | ||
659 | Workspaces::iterator w_it = m_workspaces_list.begin(); | 670 | destroyAndClearList(m_workspaces_list); |
660 | Workspaces::iterator w_it_end = m_workspaces_list.end(); | 671 | destroyAndClearList(m_icon_list); |
661 | for(; w_it != w_it_end; ++w_it) { | 672 | destroyAndClearList(m_netizen_list); |
662 | delete (*w_it); | ||
663 | } | ||
664 | m_workspaces_list.clear(); | ||
665 | |||
666 | Icons::iterator i_it = m_icon_list.begin(); | ||
667 | Icons::iterator i_it_end = m_icon_list.end(); | ||
668 | for(; i_it != i_it_end; ++i_it) { | ||
669 | delete (*i_it); | ||
670 | } | ||
671 | m_icon_list.clear(); | ||
672 | |||
673 | Netizens::iterator n_it = m_netizen_list.begin(); | ||
674 | Netizens::iterator n_it_end = m_netizen_list.end(); | ||
675 | for(; n_it != n_it_end; ++n_it) { | ||
676 | delete (*n_it); | ||
677 | } | ||
678 | |||
679 | m_netizen_list.clear(); | ||
680 | 673 | ||
681 | if (hasXinerama() && m_xinerama_headinfo) { | 674 | if (hasXinerama() && m_xinerama_headinfo) { |
682 | delete [] m_xinerama_headinfo; | 675 | delete [] m_xinerama_headinfo; |