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

Unified Diff: chrome/browser/ui/views/notifications/balloon_view.cc

Issue 9348113: Fix two crash and potential leak&crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
Index: chrome/browser/ui/views/notifications/balloon_view.cc
diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc
index 54a832bf0ea5f3a8660e903d81e66d7dcbd341aa..fb2fcff6c4c5c51a9eb77f225edaf0057a32c279 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view.cc
@@ -124,6 +124,17 @@ BalloonViewImpl::~BalloonViewImpl() {
}
void BalloonViewImpl::Close(bool by_user) {
+ animation_->Stop();
+ html_contents_->Shutdown();
+ // Detach contents from widget before then close.
+ // This is necessary because a widget may be deleted
+ // after this when chrome is shutting down.
+ html_container_->GetRootView()->RemoveAllChildViews(true);
+ html_container_->Close();
+ frame_container_->GetRootView()->RemoveAllChildViews(true);
+ frame_container_->Close();
+ // Post the tast at the end to sure this this WidgetDelegate
+ // instance is avaiable when Widget::CloseNow gets called.
MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&BalloonViewImpl::DelayedClose,
method_factory_.GetWeakPtr(),
@@ -176,13 +187,6 @@ void BalloonViewImpl::ButtonPressed(views::Button* sender,
}
void BalloonViewImpl::DelayedClose(bool by_user) {
- html_contents_->Shutdown();
- html_container_->CloseNow();
- // The BalloonViewImpl has to be detached from frame_container_ now
- // because CloseNow on linux/views destroys the view hierachy
- // asynchronously.
- frame_container_->GetRootView()->RemoveAllChildViews(true);
- frame_container_->CloseNow();
balloon_->OnClose(by_user);
}

Powered by Google App Engine
This is Rietveld 408576698