Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: mojo/services/public/cpp/view_manager/lib/node.cc

Issue 424533002: Cleans up usage of ViewManagerServiceImpl::roots_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix attempt 2 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/public/cpp/view_manager/lib/node.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/node.cc b/mojo/services/public/cpp/view_manager/lib/node.cc
index 292cf29e381ca53f29914b2495ccabbdf1598d71..738a5be97c4750e9f6db3e5e53282d1cc65e7297 100644
--- a/mojo/services/public/cpp/view_manager/lib/node.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node.cc
@@ -216,8 +216,17 @@ void Node::Destroy() {
if (manager_)
static_cast<ViewManagerClientImpl*>(manager_)->DestroyNode(id_);
- while (!children_.empty())
- children_.front()->Destroy();
+ while (!children_.empty()) {
+ Node* child = children_.front();
+ if (!OwnsNode(manager_, child)) {
+ NodePrivate(child).ClearParent();
+ children_.erase(children_.begin());
+ } else {
+ child->Destroy();
+ DCHECK(std::find(children_.begin(), children_.end(), child) ==
+ children_.end());
+ }
+ }
LocalDestroy();
}
« no previous file with comments | « no previous file | mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698