Commit 337eb8e9 authored by yurys@chromium.org's avatar yurys@chromium.org

Crash when trying to close chrome://inspect

Stop listening notifications and refreshing chrome://inspect page after it was closed.

BUG=125283
TEST=None

Review URL: https://chromiumcodereview.appspot.com/10206036

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134457 0039d316-1c4b-4281-b951-d872f2087c98
parent 60e60dd3
......@@ -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();
}
......@@ -27,6 +27,8 @@ class InspectUI : public content::WebUIController,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
void StopListeningNotifications();
scoped_refptr<WorkerCreationDestructionListener> observer_;
// A scoped container for notification registries.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment