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

Unified Diff: chrome/browser/ui/webui/inspect_ui.cc

Issue 10206036: Crash when trying to close chrome://inspect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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 | « chrome/browser/ui/webui/inspect_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/inspect_ui.cc
diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc
index 27d538325af0574a66bd53822f0d4c6b58493b57..a5a0194effaa718fadb03bbf3306c8fec74c74bf 100644
--- a/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chrome/browser/ui/webui/inspect_ui.cc
@@ -397,8 +397,7 @@ InspectUI::InspectUI(content::WebUI* web_ui)
}
InspectUI::~InspectUI() {
- observer_->InspectUIDestroyed();
- observer_ = NULL;
+ StopListeningNotifications();
}
void InspectUI::RefreshUI() {
@@ -408,5 +407,19 @@ void InspectUI::RefreshUI() {
void InspectUI::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ if (source == content::Source<WebContents>(web_ui()->GetWebContents())) {
+ if (type == content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED)
+ StopListeningNotifications();
+ return;
+ }
RefreshUI();
}
+
+void InspectUI::StopListeningNotifications()
+{
+ if (!observer_)
+ return;
+ observer_->InspectUIDestroyed();
+ observer_ = NULL;
+ registrar_.RemoveAll();
+}
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698