diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:05:26 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:05:26 +0000 |
commit | aab81c488480c235869f5e9c4ca1f02770d7d088 (patch) | |
tree | 7120e64e4566c007991d7cb9ff67e2c8629ce471 /chrome | |
parent | 58b359d1055914da02ca1b79ea228118dff5ba44 (diff) | |
download | chromium_src-aab81c488480c235869f5e9c4ca1f02770d7d088.zip chromium_src-aab81c488480c235869f5e9c4ca1f02770d7d088.tar.gz chromium_src-aab81c488480c235869f5e9c4ca1f02770d7d088.tar.bz2 |
Fixes bug in tree view deleting items if there was no root. The old
code would attempt to access an HTREEITEM after it was removed,
leading to weird problems.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/28275
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/views/tree_view.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc index 5f04ac4..4e77db0 100644 --- a/chrome/views/tree_view.cc +++ b/chrome/views/tree_view.cc @@ -525,10 +525,9 @@ void TreeView::DeleteRootItems() { if (root_shown_) { RecursivelyDelete(GetNodeDetailsByTreeItem(root)); } else { - HTREEITEM node; - while ((node = TreeView_GetChild(tree_view_, root))) { - RecursivelyDelete(GetNodeDetailsByTreeItem(node)); - } + do { + RecursivelyDelete(GetNodeDetailsByTreeItem(root)); + } while ((root = TreeView_GetRoot(tree_view_))); } } } |