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

Unified Diff: chrome/browser/extensions/window_event_router.cc

Issue 10837170: Fix crash in WindowEventRouter::OnActiveWindowChanged when closing an incognito window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/window_event_router.cc
diff --git a/chrome/browser/extensions/window_event_router.cc b/chrome/browser/extensions/window_event_router.cc
index dc056de22018f4026d00c98d7a01c30d8a0557a9..7b2c68f37c0a28c26ef3044540abc265efa2baf7 100644
--- a/chrome/browser/extensions/window_event_router.cc
+++ b/chrome/browser/extensions/window_event_router.cc
@@ -128,6 +128,7 @@ void WindowEventRouter::OnActiveWindowChanged(
// window_profile is either the default profile for the active window, its
// incognito profile, or NULL iff the previous profile is losing focus.
+ // Note that |previous_focused_profile| may already be destroyed!
Profile* previous_focused_profile = focused_profile_;
focused_profile_ = window_profile;
focused_window_id_ = window_id;
@@ -137,7 +138,7 @@ void WindowEventRouter::OnActiveWindowChanged(
std::string real_json_args;
base::JSONWriter::Write(&real_args, &real_json_args);
- // When switching between windows in the default and incognitoi profiles,
+ // When switching between windows in the default and incognito profiles,
// dispatch WINDOW_ID_NONE to extensions whose profile lost focus that
// can't see the new focused window across the incognito boundary.
// See crbug.com/46610.
@@ -150,14 +151,10 @@ void WindowEventRouter::OnActiveWindowChanged(
base::JSONWriter::Write(&none_args, &none_json_args);
}
- if (!window_profile)
- window_profile = previous_focused_profile;
- if (!profile_->IsSameProfile(window_profile) ||
- !ExtensionSystem::Get(window_profile)->event_router()) {
+ if ((window_profile && !profile_->IsSameProfile(window_profile)))
Yoyo Zhou 2012/08/08 19:36:58 excessive parentheses
dcheng 2012/08/08 20:05:56 Already removed in my latest snapshot.
return;
- }
- ExtensionSystem::Get(window_profile)->event_router()->
+ ExtensionSystem::Get(profile_)->event_router()->
Yoyo Zhou 2012/08/08 19:36:58 This seems to be the important fix.
DispatchEventsToRenderersAcrossIncognito(
event_names::kOnWindowFocusedChanged,
real_json_args,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698