From faa6c2a26deb18469066a74b2d6c76fdae5931c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 Jan 2012 18:38:02 +0300 Subject: Prevent adding double attributes to status window. --- src/gui/statuswindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gui/statuswindow.cpp') diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index b3e3f38f3..20a017a41 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -431,10 +431,20 @@ void StatusWindow::addAttribute(int id, const std::string &name, disp = new DerDisplay(id, name); mDAttrCont->add(disp); } - mAttrs[id] = disp; } +void StatusWindow::clearAttributes() +{ + mAttrCont->clear(); + mDAttrCont->clear(); + Attrs::iterator it = mAttrs.begin(); + Attrs::iterator it_end = mAttrs.end(); + for (; it != it_end; ++ it) + delete (*it).second; + mAttrs.clear(); +} + void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) { if (!bar) -- cgit v1.2.3-70-g09d2