Repairs crash in RTreeBase::Node::LeastAreaEnlargement
This CL was originally uploaded at
https://codereview.chromium.org/269513002 but was reverted due to a high
number of crash reports on Windows. The issue was that RTree::Insert()
would remove duplicate nodes before re-inserting them, but didn't handle
the corner case where the root node would end up as a non-leaf node with
only one child. RTree::Remove() did the right thing in this case, which
is to remove the root and replace it with its solitary child, but
RTree::Insert() did not. This lead to a situation with invalid trees
being created that would ultimately lead to a crash on a subsequent
call to RTree::Insert(). A short unit test that reproduced the crash
is included.
BUG=384736
Review URL: https://codereview.chromium.org/342723002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278227 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 9dbd1f8165a7808213ec6b58850d3bc5bfb3a50b
5 files changed