From a3c72a0e38b8d56680d602fd695f1daf8e9aa719 Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Thu, 23 Jul 2009 00:10:42 +0000 Subject: gtk: Fix a regression from r21320 which caused a crash when dragging a tab out of the browser. We must wrap the tab renderer widget in a GtkFixed in order to maintain the size we request for the widget; otherwise, the widget will fill the entire window. BUG=none TEST=Drag a tab out of the window. This should not crash. Review URL: http://codereview.chromium.org/155965 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21348 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/tabs/dragged_tab_gtk.cc | 8 +++++++- chrome/browser/gtk/tabs/dragged_tab_gtk.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'chrome/browser/gtk') diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc index 0f0c4f7..2ddb607 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc @@ -60,7 +60,13 @@ DraggedTabGtk::DraggedTabGtk(TabContents* datasource, g_signal_connect(G_OBJECT(container_), "expose-event", G_CALLBACK(OnExposeEvent), this); gtk_widget_add_events(container_, GDK_STRUCTURE_MASK); - gtk_container_add(GTK_CONTAINER(container_), renderer_->widget()); + + // We contain the tab renderer in a GtkFixed in order to maintain the + // requested size. Otherwise, the widget will fill the entire window and + // cause a crash when rendering because the bounds don't match our images. + fixed_ = gtk_fixed_new(); + gtk_fixed_put(GTK_FIXED(fixed_), renderer_->widget(), 0, 0); + gtk_container_add(GTK_CONTAINER(container_), fixed_); gtk_widget_show_all(container_); } diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_gtk.h index c88c10b..0057705 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_gtk.h +++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.h @@ -118,6 +118,10 @@ class DraggedTabGtk : public AnimationDelegate { // The window that contains the dragged tab or tab contents. GtkWidget* container_; + // The fixed widget that we use to contain the tab renderer so that the + // tab widget won't be resized. + GtkWidget* fixed_; + // The native view of the tab contents. GtkWidget* contents_; -- cgit v1.1