back-ported an iterator-debug fix from libtorrent_aio

This commit is contained in:
Arvid Norberg 2011-11-16 02:27:28 +00:00
parent f540157d1b
commit c342355ab2
1 changed files with 6 additions and 2 deletions

View File

@ -486,7 +486,9 @@ namespace libtorrent
if (best_match != i)
{
int index = file_index(*best_match);
reorder_file(index, file_index(*i));
int cur_index = file_index(*i);
reorder_file(index, cur_index);
i = m_files.begin() + cur_index;
}
}
else if (pad_file_limit >= 0
@ -518,7 +520,9 @@ namespace libtorrent
// alignment
TORRENT_ASSERT(best_match != i);
int index = file_index(*best_match);
reorder_file(index, file_index(*i));
int cur_index = file_index(*i);
reorder_file(index, cur_index);
i = m_files.begin() + cur_index;
i->offset = off;
off += i->size;