diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-03-22 22:49:14 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-13 22:40:51 +0100 |
commit | b44ac46e4e54f228fd9c25c042da2efd2ab45b64 (patch) | |
tree | 558fe562a65f7608485fd0453f2f0403b3a73fb2 /src/menu/drawable_control.cpp | |
parent | ce83bbe3db755828faea0490ede53f8889ba0254 (diff) | |
download | usdx-b44ac46e4e54f228fd9c25c042da2efd2ab45b64.tar.gz usdx-b44ac46e4e54f228fd9c25c042da2efd2ab45b64.tar.xz usdx-b44ac46e4e54f228fd9c25c042da2efd2ab45b64.zip |
menu/container: cleanup while destruction of container
while a container is destructed, the parent of all containing
controls will be removed, so that the controls it self do not try to
unregister itself from the destroyed container later (while
destruction the control class of the container and destroying all
slave controls)
Diffstat (limited to '')
-rw-r--r-- | src/menu/drawable_control.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
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) { |