diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 17:18:40 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 17:18:40 +0000 |
commit | e3bfce524f3546661935e8448bad35a5571d8e22 (patch) | |
tree | 65c095fcb6cf4adea578abebfd92d9500840145e /ui | |
parent | adbae7e226e63018f388bdb197ca5c8f36514a45 (diff) | |
download | chromium_src-e3bfce524f3546661935e8448bad35a5571d8e22.zip chromium_src-e3bfce524f3546661935e8448bad35a5571d8e22.tar.gz chromium_src-e3bfce524f3546661935e8448bad35a5571d8e22.tar.bz2 |
ui/base/models: Fix the API example code comment.
Allocating |root| on the stack and passing to |model|, also on the stack,
does _not_ work, because TreeNodeModel owns the root.
So when the dtor of TreeNodeModel is called, it attempts to free an invalid
pointer, which was already deleted.
BUG=None
TEST=None
R=sky@chromium.org
Review URL: http://codereview.chromium.org/7171001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/models/tree_node_model.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/base/models/tree_node_model.h b/ui/base/models/tree_node_model.h index e0f129b..38062a3 100644 --- a/ui/base/models/tree_node_model.h +++ b/ui/base/models/tree_node_model.h @@ -38,10 +38,10 @@ namespace ui { // The following example creates a TreeNode with two children and then // creates a TreeNodeModel from it: // -// TreeNodeWithValue<int> root; -// root.Add(new TreeNodeWithValue<int>(ASCIIToUTF16("child 1"), 0)); -// root.Add(new TreeNodeWithValue<int>(ASCIIToUTF16("child 2"), 1)); -// TreeNodeModel<TreeNodeWithValue<int> > model(&root); +// TreeNodeWithValue<int>* root = new TreeNodeWithValue<int>(); +// root->Add(new TreeNodeWithValue<int>(ASCIIToUTF16("child 1"), 0)); +// root->Add(new TreeNodeWithValue<int>(ASCIIToUTF16("child 2"), 1)); +// TreeNodeModel<TreeNodeWithValue<int> > model(root); // // Two variants of TreeNode are provided here: // |