diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-14 12:39:25 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-14 12:39:25 +0000 |
commit | fcbeb0c310f9d42cf9043b49f22ebf09f0207cc3 (patch) | |
tree | 07b6c6331b1332f09dfa78030ed27c9551648b39 /ui/views/examples/text_example.cc | |
parent | ab86e06dd210e3908d109ff3f45751c3dd6757b9 (diff) | |
download | chromium_src-fcbeb0c310f9d42cf9043b49f22ebf09f0207cc3.zip chromium_src-fcbeb0c310f9d42cf9043b49f22ebf09f0207cc3.tar.gz chromium_src-fcbeb0c310f9d42cf9043b49f22ebf09f0207cc3.tar.bz2 |
views: Fixes leak in TextExample::AddCombobox.
Combobox does not own its model, so the caller is responsible for deleting it.
This patch does this by using a scoped_ptr.
R=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9389007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121876 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/examples/text_example.cc')
-rw-r--r-- | ui/views/examples/text_example.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc index e579d85..208ce66 100644 --- a/ui/views/examples/text_example.cc +++ b/ui/views/examples/text_example.cc @@ -188,7 +188,8 @@ Combobox* TextExample::AddCombobox(GridLayout* layout, int count) { layout->StartRow(0, 0); layout->AddView(new Label(ASCIIToUTF16(name))); - Combobox* combo_box = new Combobox(new ExampleComboboxModel(strings, count)); + example_combobox_model_.reset(new ExampleComboboxModel(strings, count)); + Combobox* combo_box = new Combobox(example_combobox_model_.get()); combo_box->SetSelectedItem(0); combo_box->set_listener(this); layout->AddView(combo_box, kNumColumns - 1, 1); |