aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/menu/container.cpp5
-rw-r--r--src/menu/drawable_control.cpp13
-rw-r--r--src/menu/drawable_control.hpp2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/menu/container.cpp b/src/menu/container.cpp
index 4ac26548..795d57ab 100644
--- a/src/menu/container.cpp
+++ b/src/menu/container.cpp
@@ -46,6 +46,11 @@ namespace usdx
Container::~Container()
{
+ for (std::list<DrawableControl*>::iterator next = controls.begin(), it = next++;
+ it != controls.end(); it = next++) {
+ (*it)->remove_parent();
+ }
+
controls.clear();
}
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp
index 72486d42..00b6fa78 100644
--- a/src/menu/drawable_control.cpp
+++ b/src/menu/drawable_control.cpp
@@ -52,10 +52,7 @@ namespace usdx
DrawableControl::~DrawableControl()
{
- if (parent) {
- parent->remove(this);
- parent = NULL;
- }
+ remove_parent();
}
bool DrawableControl::get_clipping_required(void) const
@@ -151,6 +148,14 @@ namespace usdx
return size.get_height();
}
+ void DrawableControl::remove_parent(void)
+ {
+ if (parent) {
+ parent->remove(this);
+ parent = NULL;
+ }
+ }
+
DrawableControl::ContainerHelper::ContainerHelper(DrawableControl* self) :
self(self)
{
diff --git a/src/menu/drawable_control.hpp b/src/menu/drawable_control.hpp
index 64bd5a24..2acdd7ec 100644
--- a/src/menu/drawable_control.hpp
+++ b/src/menu/drawable_control.hpp
@@ -90,6 +90,8 @@ namespace usdx
const Dimension<int>& get_size(void) const;
int get_width(void) const;
int get_height(void) const;
+
+ void remove_parent(void);
};
};