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

Unified Diff: mandoline/tab/frame.cc

Issue 1153393007: Fix assert on Mandoline shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 5 years, 6 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 | « mandoline/tab/frame.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mandoline/tab/frame.cc
diff --git a/mandoline/tab/frame.cc b/mandoline/tab/frame.cc
index 8928e0db9b657a225f375a67871d6abfb86e728e..3a6ebc4909c91a50c07589805826e39c955b71c8 100644
--- a/mandoline/tab/frame.cc
+++ b/mandoline/tab/frame.cc
@@ -43,11 +43,13 @@ Frame::Frame(FrameTree* tree,
}
Frame::~Frame() {
- view_->RemoveObserver(this);
+ if (view_)
+ view_->RemoveObserver(this);
STLDeleteElements(&children_);
if (parent_)
parent_->Remove(this);
- view_->ClearLocalProperty(kFrame);
+ if (view_)
+ view_->ClearLocalProperty(kFrame);
if (view_ownership_ == ViewOwnership::OWNS_VIEW)
view_->Destroy();
}
@@ -78,15 +80,20 @@ void Frame::Remove(Frame* node) {
void Frame::OnViewDestroying(mojo::View* view) {
if (parent_)
parent_->Remove(this);
- // Assume the view associated with the root is never deleted out from under
- // us.
- // TODO(sky): this is likely bogus. Change browser to create a child for
- // each FrameTree.
- DCHECK_NE(this, tree_->root());
// Reset |view_ownership_| so we don't attempt to delete |view_| in the
// destructor.
view_ownership_ = ViewOwnership::DOESNT_OWN_VIEW;
+
+ // Assume the view associated with the root is never deleted out from under
+ // us.
+ // TODO(sky): Change browser to create a child for each FrameTree.
+ if (tree_->root() == this) {
+ view_->RemoveObserver(this);
+ view_ = nullptr;
+ return;
+ }
+
delete this;
}
« no previous file with comments | « mandoline/tab/frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698