summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 03:03:30 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-15 03:03:30 +0000
commit9504f194280791e04b468ecb518e175305757c5f (patch)
tree7f3411d03213e38048c91bd7c15fc5ee1f642f17 /chrome/browser/importer
parent4ff391fcc5b88061912f73ec570f389100cc5e2a (diff)
downloadchromium_src-9504f194280791e04b468ecb518e175305757c5f.zip
chromium_src-9504f194280791e04b468ecb518e175305757c5f.tar.gz
chromium_src-9504f194280791e04b468ecb518e175305757c5f.tar.bz2
Fix erase method usage on STL containers in Chrome. Invoking erase on the iterator renders it invalid. We were continuing to use this iterator.
R=darin Review URL: http://codereview.chromium.org/10925 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 61b4b5b..719ebcc 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -195,11 +195,13 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
std::map<std::wstring, TemplateURL*> search_engine_for_url;
std::string content;
+ bool need_to_increment_iter;
// The first XML file represents the default search engine in Firefox 3, so we
// need to keep it on top of the list.
TemplateURL* default_turl = NULL;
for (std::vector<std::wstring>::const_iterator iter = xml_files.begin();
- iter != xml_files.end(); ++iter) {
+ iter != xml_files.end();) {
+ need_to_increment_iter = true;
file_util::ReadFileToString(*iter, &content);
TemplateURL* template_url = new TemplateURL();
FirefoxURLParameterFilter param_filter;
@@ -216,7 +218,8 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
// returns a vector with first Firefox default search engines and then
// the user's ones. We want to give priority to the user ones.
delete iter->second;
- search_engine_for_url.erase(iter);
+ iter = search_engine_for_url.erase(iter);
+ need_to_increment_iter = false;
}
// Give this a keyword to facilitate tab-to-search, if possible.
template_url->set_keyword(TemplateURLModel::GenerateKeyword(GURL(url),
@@ -229,6 +232,8 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
delete template_url;
}
content.clear();
+ if (need_to_increment_iter)
+ ++iter;
}
// Put the results in the |search_engines| vector.