summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc9
-rw-r--r--chrome/browser/resource_dispatcher_host.cc2
-rw-r--r--chrome/browser/resource_dispatcher_host.h5
-rw-r--r--chrome/views/tabbed_pane.cc3
4 files changed, 14 insertions, 5 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.
diff --git a/chrome/browser/resource_dispatcher_host.cc b/chrome/browser/resource_dispatcher_host.cc
index fdaadc3..6f1aba3 100644
--- a/chrome/browser/resource_dispatcher_host.cc
+++ b/chrome/browser/resource_dispatcher_host.cc
@@ -1923,7 +1923,7 @@ void ResourceDispatcherHost::RemovePendingRequest(int render_process_host_id,
}
void ResourceDispatcherHost::RemovePendingRequest(
- PendingRequestList::iterator& iter) {
+ const PendingRequestList::iterator& iter) {
// Notify the login handler that this request object is going away.
ExtraRequestInfo* info = ExtraInfoForRequest(iter->second);
if (info && info->login_handler)
diff --git a/chrome/browser/resource_dispatcher_host.h b/chrome/browser/resource_dispatcher_host.h
index 3207965..fc21c7e 100644
--- a/chrome/browser/resource_dispatcher_host.h
+++ b/chrome/browser/resource_dispatcher_host.h
@@ -414,7 +414,10 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
const std::string& content_disposition);
void RemovePendingRequest(int render_process_host_id, int request_id);
- void RemovePendingRequest(PendingRequestList::iterator& iter);
+ // Deletes the pending request identified by the iterator passed in.
+ // This function will invalidate the iterator passed in. Callers should
+ // not rely on this iterator being valid on return.
+ void RemovePendingRequest(const PendingRequestList::iterator& iter);
// Notify our observers that we started receiving a response for a request.
void NotifyResponseStarted(URLRequest* request, int render_process_host_id);
diff --git a/chrome/views/tabbed_pane.cc b/chrome/views/tabbed_pane.cc
index bab0d72..9fe72a7 100644
--- a/chrome/views/tabbed_pane.cc
+++ b/chrome/views/tabbed_pane.cc
@@ -120,9 +120,10 @@ View* TabbedPane::RemoveTabAtIndex(int index) {
ResizeContents(tab_control_);
std::vector<View*>::iterator iter = tab_views_.begin() + index;
+ View* removed_tab = *iter;
tab_views_.erase(iter);
- return *iter;
+ return removed_tab;
}
void TabbedPane::SelectTabAt(int index) {