diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 22:12:23 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 22:12:23 +0000 |
commit | ee8f54a54cab5cc3eaf837622ec61b482fac8858 (patch) | |
tree | 4e9b080e8415af1662fe21357f39c16a1587a7ef /views | |
parent | 9487e849e3692811cc0f4a96373234176b78a943 (diff) | |
download | chromium_src-ee8f54a54cab5cc3eaf837622ec61b482fac8858.zip chromium_src-ee8f54a54cab5cc3eaf837622ec61b482fac8858.tar.gz chromium_src-ee8f54a54cab5cc3eaf837622ec61b482fac8858.tar.bz2 |
Fixes to get gtk/views to bring up browser window w/out crashing
TBR: beng
Review URL: http://codereview.chromium.org/118051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/native_button_gtk.cc | 2 | ||||
-rw-r--r-- | views/controls/native/native_view_host_gtk.cc | 4 | ||||
-rw-r--r-- | views/controls/native_control_gtk.cc | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc index 63da111..3731d45 100644 --- a/views/controls/button/native_button_gtk.cc +++ b/views/controls/button/native_button_gtk.cc @@ -69,6 +69,8 @@ void NativeButtonGtk::SetFocus() { } gfx::Size NativeButtonGtk::GetPreferredSize() { + if (!native_view()) + return gfx::Size(); GtkRequisition size_request = { 0, 0 }; gtk_widget_size_request(native_view(), &size_request); return gfx::Size(size_request.width, size_request.height); diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc index 96a1291..223f3c2 100644 --- a/views/controls/native/native_view_host_gtk.cc +++ b/views/controls/native/native_view_host_gtk.cc @@ -74,6 +74,8 @@ void NativeViewHostGtk::NativeViewDetaching() { } void NativeViewHostGtk::AddedToWidget() { + if (!host_->native_view()) + return; WidgetGtk* parent_widget = static_cast<WidgetGtk*>(host_->GetWidget()); GtkWidget* widget_parent = gtk_widget_get_parent(host_->native_view()); GtkWidget* parent_widget_widget = parent_widget->child_widget_parent(); @@ -112,7 +114,7 @@ void NativeViewHostGtk::InstallClip(int x, int y, int w, int h) { // widget in a GtkFixed with a window. We have to do this as not all widgets // support turning on GTK_NO_WINDOW (for example, buttons don't appear to // draw anything when they have a window). - NOTREACHED(); + // NOTREACHED(); return; } DCHECK(has_window); diff --git a/views/controls/native_control_gtk.cc b/views/controls/native_control_gtk.cc index cae4476..b1ec8b7 100644 --- a/views/controls/native_control_gtk.cc +++ b/views/controls/native_control_gtk.cc @@ -32,13 +32,13 @@ void NativeControlGtk::SetEnabled(bool enabled) { void NativeControlGtk::ViewHierarchyChanged(bool is_add, View* parent, View* child) { + // Call the base class to hide the view if we're being removed. + NativeViewHost::ViewHierarchyChanged(is_add, parent, child); + // Create the widget when we're added to a valid Widget. Many controls need a // parent widget to function properly. if (is_add && GetWidget() && !native_view()) CreateNativeControl(); - - // Call the base class to hide the view if we're being removed. - NativeViewHost::ViewHierarchyChanged(is_add, parent, child); } void NativeControlGtk::VisibilityChanged(View* starting_from, bool is_visible) { |