diff options
author | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 15:08:31 +0000 |
---|---|---|
committer | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 15:08:31 +0000 |
commit | 47dcbdc226f6cf62bc6d597bbc3ed5cd041255d5 (patch) | |
tree | c946eeb6b23d64fce6266b72e84a14adc0214033 /content | |
parent | ec165e1cfff8d44fc5674ef7304e1c9dd7d02c87 (diff) | |
download | chromium_src-47dcbdc226f6cf62bc6d597bbc3ed5cd041255d5.zip chromium_src-47dcbdc226f6cf62bc6d597bbc3ed5cd041255d5.tar.gz chromium_src-47dcbdc226f6cf62bc6d597bbc3ed5cd041255d5.tar.bz2 |
Fix a crash where an index to a modified array wasn't always kept up to date.
BUG=83924
TEST=Make sure the navigation history is correct.
Review URL: http://codereview.chromium.org/7078002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/tab_contents/navigation_controller.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 4bcf8dd6..564203f 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -1041,10 +1041,14 @@ void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry, if (current_size > 0) { // Prune any entries which are in front of the current entry. // Also prune the current entry if we are to replace the current entry. - int prune_up_to = replace ? last_committed_entry_index_ - 1 - : last_committed_entry_index_; + // last_committed_entry_index_ must be updated here since calls to + // NotifyPrunedEntries() below may re-enter and we must make sure + // last_committed_entry_index_ is not left in an invalid state. + if (replace) + --last_committed_entry_index_; + int num_pruned = 0; - while (prune_up_to < (current_size - 1)) { + while (last_committed_entry_index_ < (current_size - 1)) { num_pruned++; entries_.pop_back(); current_size--; |