From 4ae7bbc22f33fa06e12d20ca1ebdef2a1cd3b12c Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Wed, 21 Sep 2011 14:33:42 +0000 Subject: views: Add comment to Combobox's native wrapper about its lifetime. R=sky@chromium.org Review URL: http://codereview.chromium.org/7982009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102105 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/combobox/combobox.cc | 5 +++-- views/controls/combobox/combobox.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'views/controls') diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index 0f8ee2b..c8bd106 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -126,9 +126,10 @@ void Combobox::GetAccessibleState(ui::AccessibleViewState* state) { state->count = model()->GetItemCount(); } -void Combobox::ViewHierarchyChanged(bool is_add, View* parent, - View* child) { +void Combobox::ViewHierarchyChanged(bool is_add, View* parent, View* child) { if (is_add && !native_wrapper_ && GetWidget()) { + // The native wrapper's lifetime will be managed by the view hierarchy after + // we call AddChildView. native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); AddChildView(native_wrapper_->GetView()); } diff --git a/views/controls/combobox/combobox.h b/views/controls/combobox/combobox.h index 1971f7f..a582688 100644 --- a/views/controls/combobox/combobox.h +++ b/views/controls/combobox/combobox.h @@ -82,7 +82,8 @@ class VIEWS_EXPORT Combobox : public View { protected: // Overridden from View: - virtual void ViewHierarchyChanged(bool is_add, View* parent, + virtual void ViewHierarchyChanged(bool is_add, + View* parent, View* child) OVERRIDE; virtual std::string GetClassName() const OVERRIDE; -- cgit v1.1