summaryrefslogtreecommitdiffstats
path: root/views/controls/native/native_view_host_gtk.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 19:50:42 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 19:50:42 +0000
commit99050a88a4fe4f4acaa7b98e94cea7f0a84b4f18 (patch)
treeb96fc0e8370fd4e49547b345f44cbd7c9413103f /views/controls/native/native_view_host_gtk.cc
parentc7594166521973b656f13d7c08b75db7b603246f (diff)
downloadchromium_src-99050a88a4fe4f4acaa7b98e94cea7f0a84b4f18.zip
chromium_src-99050a88a4fe4f4acaa7b98e94cea7f0a84b4f18.tar.gz
chromium_src-99050a88a4fe4f4acaa7b98e94cea7f0a84b4f18.tar.bz2
Fix two crashers with TOOLKIT_VIEWS build:
- NativeViewHostGtk::RemovedFromWidget crashes due to WidgetGtk::window_contents_ being NULL... basically when RemovedFromWidget is called from the RootView's dtor, the window_contents_ and widget_ properties of the containing WidgetGtk are NULL. It seems acceptable to not clean up in this case. - TabContentsViewGtk dtor needs to call CloseNow(). This is similar to ~TabContents() calling DestroyWindow on the view's HWND. Without this, the TabContentsViewGtk object was destroyed but the corresponding GtkWidget wasn't, and so subsequent signal handlers would crash. BUG=none TEST=none Review URL: http://codereview.chromium.org/159130 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native/native_view_host_gtk.cc')
-rw-r--r--views/controls/native/native_view_host_gtk.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/views/controls/native/native_view_host_gtk.cc b/views/controls/native/native_view_host_gtk.cc
index 6fa7325..2130a634 100644
--- a/views/controls/native/native_view_host_gtk.cc
+++ b/views/controls/native/native_view_host_gtk.cc
@@ -87,8 +87,13 @@ void NativeViewHostGtk::RemovedFromWidget() {
WidgetGtk* parent_widget = GetHostWidget();
gtk_widget_hide(host_->native_view());
if (parent_widget) {
- gtk_container_remove(GTK_CONTAINER(parent_widget->window_contents()),
- host_->native_view());
+ // We can be called after the contents widget has been destroyed, e.g. any
+ // NativeViewHost not removed from the view hierarchy before the window is
+ // closed.
+ if (GTK_IS_CONTAINER(parent_widget->window_contents())) {
+ gtk_container_remove(GTK_CONTAINER(parent_widget->window_contents()),
+ host_->native_view());
+ }
}
}