diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 21:19:55 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 21:19:55 +0000 |
commit | 15d566e53e87720f34bce1e064025b3f3927be81 (patch) | |
tree | 80a56912c128c2a4605973dae82e377681fcaa45 /views | |
parent | 6ad2e0a474b31402cc23451a19a04f5209a6c95f (diff) | |
download | chromium_src-15d566e53e87720f34bce1e064025b3f3927be81.zip chromium_src-15d566e53e87720f34bce1e064025b3f3927be81.tar.gz chromium_src-15d566e53e87720f34bce1e064025b3f3927be81.tar.bz2 |
Fixes crash in tooltips. I was freeing a PangoFontDescription that I
shouldn't have. I also added code to set the name of the widgets
created by WidgetGtk.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/443006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/tooltip_manager_gtk.cc | 13 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 4 |
2 files changed, 6 insertions, 11 deletions
diff --git a/views/widget/tooltip_manager_gtk.cc b/views/widget/tooltip_manager_gtk.cc index 9a4316b..b1fae39 100644 --- a/views/widget/tooltip_manager_gtk.cc +++ b/views/widget/tooltip_manager_gtk.cc @@ -29,9 +29,7 @@ static gfx::Font* LoadDefaultFont() { gtk_widget_realize(window); GtkStyle* style = gtk_widget_get_style(label); - PangoFontDescription* pfd = style->font_desc; - gfx::Font* font = new gfx::Font(gfx::Font::CreateFont(pfd)); - pango_font_description_free(pfd); + gfx::Font* font = new gfx::Font(gfx::Font::CreateFont(style->font_desc)); gtk_widget_destroy(window); @@ -103,15 +101,8 @@ static void AdjustLabel(GtkTooltip* tooltip) { GtkLabel* real_label = NULL; gtk_container_foreach(GTK_CONTAINER(parent), LabelLocatorCallback, static_cast<gpointer>(&real_label)); - if (real_label) { - // For some reason I'm occasionally seeing a crash in trying to get font - // metrics. Explicitly setting the font avoids this. - PangoFontDescription* pfd = - gfx::Font::PangoFontFromGfxFont(gfx::Font()); - gtk_widget_modify_font(GTK_WIDGET(real_label), pfd); - pango_font_description_free(pfd); + if (real_label) gtk_label_set_max_width_chars(GTK_LABEL(real_label), 3000); - } } } diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 26e8ddf..8dd0322 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -1154,11 +1154,13 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { // region, it wouldn't get painted. if (type_ == TYPE_CHILD) { window_contents_ = widget_ = gtk_fixed_new(); + gtk_widget_set_name(widget_, "views-gtkwidget-child-fixed"); GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED); gtk_fixed_set_has_window(GTK_FIXED(widget_), true); if (!parent && !null_parent_) { GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); null_parent_ = gtk_fixed_new(); + gtk_widget_set_name(widget_, "views-gtkwidget-null-parent"); gtk_container_add(GTK_CONTAINER(popup), null_parent_); gtk_widget_realize(null_parent_); } @@ -1167,6 +1169,7 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { widget_ = gtk_window_new( (type_ == TYPE_WINDOW || type_ == TYPE_DECORATED_WINDOW) ? GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP); + gtk_widget_set_name(widget_, "views-gtkwidget-window"); if (transient_to_parent_) gtk_window_set_transient_for(GTK_WINDOW(widget_), GTK_WINDOW(parent)); GTK_WIDGET_UNSET_FLAGS(widget_, GTK_DOUBLE_BUFFERED); @@ -1186,6 +1189,7 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { SetWindowForNative(widget_, static_cast<WindowGtk*>(this)); window_contents_ = gtk_fixed_new(); + gtk_widget_set_name(window_contents_, "views-gtkwidget-window-fixed"); GTK_WIDGET_UNSET_FLAGS(window_contents_, GTK_DOUBLE_BUFFERED); gtk_fixed_set_has_window(GTK_FIXED(window_contents_), true); gtk_container_add(GTK_CONTAINER(widget_), window_contents_); |