From f1620abfad0caf85b5958e32736accb3fecef7f1 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 29 Mar 2013 08:38:46 +0100 Subject: [PATCH] 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 file changed, 10 insertions(+) diff --git a/src/ui/ui.c b/src/ui/ui.c index 2f2fc3aa0..af28263be 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; }