1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2025-04-21 12:27:27 +03:00

Fix dynamic allocation of IconButton instances

Previously, IconButton instances to be added to button boxes were
allocated with new, but never freed with delete.

unique_ptr makes sure the buttons will be freed along with the button
box that owns them, or when code calls ButtonBox::clear.

The destructor of ButtonBox has been made redundant by this change, so
it's gone.
This commit is contained in:
Nebuleon Fumika
2014-08-15 21:52:48 +00:00
committed by Maarten ter Huurne
parent 004c41e2ef
commit 891525aa94
12 changed files with 118 additions and 102 deletions

View File

@@ -63,8 +63,8 @@ bool WallpaperDialog::exec()
uint i, selected = 0, firstElement = 0, iY;
ButtonBox buttonbox(gmenu2x);
buttonbox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select"]));
buttonbox.add(new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Exit"]));
buttonbox.add(unique_ptr<IconButton>(new IconButton(gmenu2x, ts, "skin:imgs/buttons/accept.png", gmenu2x->tr["Select"])));
buttonbox.add(unique_ptr<IconButton>(new IconButton(gmenu2x, ts, "skin:imgs/buttons/cancel.png", gmenu2x->tr["Exit"])));
unsigned int top, height;
tie(top, height) = gmenu2x->getContentArea();