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

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: Created 5 years, 7 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..f8b5d6de9f112f6ff0ca31fd3d04897ed2646fe4 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,19 @@ 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) {
Fady Samuel 2015/06/04 03:21:45 Alternatively, FrameTree could hold a weakptr to t
jam 2015/06/04 03:51:30 (I'll defer to Scott)
+ view_ = nullptr;
sky 2015/06/04 19:17:50 view_->RemoveObserver(this) before the return
jam 2015/06/04 19:20:48 Done.
+ 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