[mutter] ui: Fix crash getting default font
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] ui: Fix crash getting default font
- Date: Fri, 29 Mar 2013 13:10:36 +0000 (UTC)
commit f1620abfad0caf85b5958e32736accb3fecef7f1
Author: Bastien Nocera <hadess hadess net>
Date: Fri Mar 29 08:38:46 2013 +0100
ui: Fix crash getting default font
A correctly constructed GtkStyleContext must have its screen
and widget paths set. Getting the frame font caused crashes
on some systems because those were not correctly initialised.
https://bugzilla.gnome.org/show_bug.cgi?id=696814
src/ui/ui.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 2f2fc3a..af28263 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -744,7 +744,17 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
if (!font_desc)
{
+ GdkDisplay *display = gdk_x11_lookup_xdisplay (ui->xdisplay);
+ GdkScreen *screen = gdk_display_get_screen (display, XScreenNumberOfScreen (ui->xscreen));
+ GtkWidgetPath *widget_path;
+
style = gtk_style_context_new ();
+ gtk_style_context_set_screen (style, screen);
+ widget_path = gtk_widget_path_new ();
+ gtk_widget_path_append_type (widget_path, GTK_TYPE_WINDOW);
+ gtk_style_context_set_path (style, widget_path);
+ gtk_widget_path_free (widget_path);
+
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &free_font_desc, NULL);
font_desc = (const PangoFontDescription *) free_font_desc;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]