diff --git a/src/buttonbox.cpp b/src/buttonbox.cpp index 0a8d112..af2791f 100644 --- a/src/buttonbox.cpp +++ b/src/buttonbox.cpp @@ -10,8 +10,7 @@ ButtonBox::ButtonBox(GMenu2X *gmenu2x) : gmenu2x(gmenu2x) ButtonBox::~ButtonBox() { - for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it) - delete *it; + clear(); } void ButtonBox::add(Button *button) @@ -19,6 +18,11 @@ void ButtonBox::add(Button *button) buttons.push_back(button); } +void ButtonBox::clear() +{ + buttons.clear(); +} + void ButtonBox::paint(unsigned int posX) { for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it) diff --git a/src/buttonbox.h b/src/buttonbox.h index e96316a..52a8e4b 100644 --- a/src/buttonbox.h +++ b/src/buttonbox.h @@ -13,6 +13,7 @@ public: ~ButtonBox(); void add(Button *button); + void clear(); void paint(unsigned int posX); void handleTS();