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

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

Issue 8529001: Fix crash in ExtensionService::SetIsIncognitoEnabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 9 years, 1 month 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/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index bd34f2459719d93512c939efb3f673a149347912..851db298e6c9145e7fd3760263b2cc618af40ee7 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1476,11 +1476,15 @@ void ExtensionService::SetIsIncognitoEnabled(
bool extension_is_enabled = std::find(extensions_.begin(), extensions_.end(),
extension) != extensions_.end();
+
+ // When we reload the extension the ID may be invalidated if we've passed it
+ // by const ref everywhere. Make a copy to be safe.
+ std::string id = extension_id;
if (extension_is_enabled)
ReloadExtension(extension->id());
// Reloading the extension invalidates the |extension| pointer.
- extension = GetInstalledExtension(extension_id);
+ extension = GetInstalledExtension(id);
if (extension)
SyncExtensionChangeIfNeeded(*extension);
}
« 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