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

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

Issue 2845025: Fixed memory leak in ExtensionsService. (Closed)
Patch Set: Addressed asargent's comments, added tests Created 10 years, 6 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 | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service.cc
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index a416f179448d1c87f47604cb5b43c05183dd7101..a34d11cbcecc317fe6f6c5cefc69e6c3b4f7e94d 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/histogram.h"
+#include "base/stl_util-inl.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/time.h"
@@ -779,11 +780,13 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
}
void ExtensionsService::UnloadAllExtensions() {
- ExtensionList::iterator iter;
- for (iter = extensions_.begin(); iter != extensions_.end(); ++iter)
- delete *iter;
+ STLDeleteContainerPointers(extensions_.begin(), extensions_.end());
extensions_.clear();
+ STLDeleteContainerPointers(disabled_extensions_.begin(),
+ disabled_extensions_.end());
+ disabled_extensions_.clear();
+
// TODO(erikkay) should there be a notification for this? We can't use
// EXTENSION_UNLOADED since that implies that the extension has been disabled
// or uninstalled, and UnloadAll is just part of shutdown.
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698