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
parent 58ded39e
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment