diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 20:30:56 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 20:30:56 +0000 |
commit | b49fd0bdb4f9b525d8c95410be85cd9bb3cc3f83 (patch) | |
tree | 6f08df7f2bec3972c61559823ebc8d3bfc2aeaa5 /chrome/browser/extensions/lazy_background_task_queue.cc | |
parent | 58ded39e67ef7290a527008c03f0b09627d3c856 (diff) | |
download | chromium_src-b49fd0bdb4f9b525d8c95410be85cd9bb3cc3f83.zip chromium_src-b49fd0bdb4f9b525d8c95410be85cd9bb3cc3f83.tar.gz chromium_src-b49fd0bdb4f9b525d8c95410be85cd9bb3cc3f83.tar.bz2 |
Attempt at a crash fix in LazyBackgroundTaskQueue::ProcessPendingTasks.
According to windbg, it was crashing on this line:
it->Run(host);
My hypothesis is that one of the tasks modified the task list, corrupting
the iterator.
BUG=138790
TEST=no
Review URL: https://chromiumcodereview.appspot.com/10827003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/lazy_background_task_queue.cc')
-rw-r--r-- | chrome/browser/extensions/lazy_background_task_queue.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/chrome/browser/extensions/lazy_background_task_queue.cc b/chrome/browser/extensions/lazy_background_task_queue.cc index b98d446..49bc222 100644 --- a/chrome/browser/extensions/lazy_background_task_queue.cc +++ b/chrome/browser/extensions/lazy_background_task_queue.cc @@ -115,14 +115,16 @@ void LazyBackgroundTaskQueue::ProcessPendingTasks( return; } - PendingTasksList* tasks = map_it->second.get(); - for (PendingTasksList::const_iterator it = tasks->begin(); - it != tasks->end(); ++it) { + // Swap the pending tasks to a temporary, to avoid problems if the task + // list is modified during processing. + PendingTasksList tasks; + tasks.swap(*map_it->second); + for (PendingTasksList::const_iterator it = tasks.begin(); + it != tasks.end(); ++it) { it->Run(host); } - tasks->clear(); - pending_tasks_.erase(map_it); + pending_tasks_.erase(key); // Balance the keepalive in AddPendingTask. Note we don't do this on a // failure to load, because the keepalive count is reset in that case. |