diff options
author | crupest <crupest@outlook.com> | 2018-09-20 22:50:37 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-20 22:50:37 +0800 |
commit | 5f7d3268e3d2ea84a1afc97c209b703bf4092c76 (patch) | |
tree | 8cab3c7457420b55376e5825f0cdfefd47551c00 /CruUI/ui/layout_base.cpp | |
parent | 6cd7b4e168fdda6bf83187cda9269cad5f9ee0ed (diff) | |
download | cru-5f7d3268e3d2ea84a1afc97c209b703bf4092c76.tar.gz cru-5f7d3268e3d2ea84a1afc97c209b703bf4092c76.tar.bz2 cru-5f7d3268e3d2ea84a1afc97c209b703bf4092c76.zip |
Improve linear layout.
Diffstat (limited to 'CruUI/ui/layout_base.cpp')
-rw-r--r-- | CruUI/ui/layout_base.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/CruUI/ui/layout_base.cpp b/CruUI/ui/layout_base.cpp index a589d2ea..a26379a0 100644 --- a/CruUI/ui/layout_base.cpp +++ b/CruUI/ui/layout_base.cpp @@ -17,11 +17,13 @@ namespace cru::ui return; // find descendant then erase it; find ancestor then just return. - for (auto i = cache_invalid_controls_.cbegin(); i != cache_invalid_controls_.cend(); ++i) + auto i = cache_invalid_controls_.cbegin(); + while (i != cache_invalid_controls_.cend()) { - const auto result = IsAncestorOrDescendant(*i, control); + auto current_i = i++; + const auto result = IsAncestorOrDescendant(*current_i, control); if (result == control) - cache_invalid_controls_.erase(i); + cache_invalid_controls_.erase(current_i); else if (result != nullptr) return; // find a ancestor of "control", just return } |