aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/Control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/controls/Control.cpp')
-rw-r--r--src/ui/controls/Control.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/controls/Control.cpp b/src/ui/controls/Control.cpp
index 02148b72..70a3b1f3 100644
--- a/src/ui/controls/Control.cpp
+++ b/src/ui/controls/Control.cpp
@@ -27,6 +27,7 @@ Control::~Control() {
}
RemoveFromParent();
+ RemoveAllChild();
}
std::string Control::GetDebugId() const {
@@ -89,9 +90,8 @@ void Control::InsertChildAt(Control* control, Index index) {
children_.insert(children_.cbegin() + index, control);
control->parent_ = this;
-
- TraverseDescendents([this](Control* control) { control->host_ = host_; },
- false);
+ control->TraverseDescendents(
+ [this](Control* control) { control->host_ = host_; }, true);
if (host_) {
host_->NotifyControlParentChange(control, nullptr, this);
}
@@ -111,8 +111,8 @@ void Control::RemoveChildAt(Index index) {
auto control = children_[index];
children_.erase(children_.cbegin() + index);
control->parent_ = nullptr;
- TraverseDescendents([this](Control* control) { control->host_ = nullptr; },
- false);
+ control->TraverseDescendents(
+ [this](Control* control) { control->host_ = nullptr; }, true);
if (host_) {
host_->NotifyControlParentChange(control, this, nullptr);
}