Index: views/controls/tabbed_pane/tabbed_pane.cc |
diff --git a/views/controls/tabbed_pane/tabbed_pane.cc b/views/controls/tabbed_pane/tabbed_pane.cc |
index 28920f431458710a50b73df943060771e6595d37..3dec215c0ca6952e34639d5da89c6ab4158f0759 100644 |
--- a/views/controls/tabbed_pane/tabbed_pane.cc |
+++ b/views/controls/tabbed_pane/tabbed_pane.cc |
@@ -71,10 +71,6 @@ gfx::Size TabbedPane::GetPreferredSize() { |
native_tabbed_pane_->GetPreferredSize() : gfx::Size(); |
} |
-void TabbedPane::CreateWrapper() { |
- native_tabbed_pane_ = NativeTabbedPaneWrapper::CreateNativeWrapper(this); |
-} |
- |
void TabbedPane::LoadAccelerators() { |
// Ctrl+Shift+Tab |
AddAccelerator(views::Accelerator(ui::VKEY_TAB, true, true, false)); |
@@ -89,7 +85,9 @@ void TabbedPane::Layout() { |
void TabbedPane::ViewHierarchyChanged(bool is_add, View* parent, View* child) { |
if (is_add && !native_tabbed_pane_) { |
- CreateWrapper(); |
+ // The native wrapper's lifetime will be managed by the view hierarchy after |
+ // we call AddChildView. |
+ native_tabbed_pane_ = NativeTabbedPaneWrapper::CreateNativeWrapper(this); |
AddChildView(native_tabbed_pane_->GetView()); |
LoadAccelerators(); |
} |