[gtk+] settings: Avoid a crash



commit fe7be14db8efb08e72e22f60c2640cdc1fdfcd6e
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 5 13:30:55 2016 -0400

    settings: Avoid a crash
    
    Christian Hergert reported seeing webkit crashes with recent
    GTK+. The stacktrace points at the CSS machinery calling into
    GtkSettings to get the font name, and then getting surprised
    by a property notification that triggers style validation.
    
    To avoid this, query the font name xsetting right away when
    we get set a screen.

 gtk/gtksettings.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 672ba61..897ee99 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -251,13 +251,14 @@ static void    settings_update_modules           (GtkSettings           *setting
 static void    settings_update_cursor_theme      (GtkSettings           *settings);
 static void    settings_update_resolution        (GtkSettings           *settings);
 static void    settings_update_font_options      (GtkSettings           *settings);
+static void    settings_update_font_values       (GtkSettings           *settings);
+static void    settings_update_font_name         (GtkSettings           *settings);
 static gboolean settings_update_fontconfig       (GtkSettings           *settings);
 static void    settings_update_theme             (GtkSettings           *settings);
 static void    settings_update_key_theme         (GtkSettings           *settings);
 static gboolean settings_update_xsetting         (GtkSettings           *settings,
                                                   GParamSpec            *pspec,
                                                   gboolean               force);
-static void     settings_update_font_values      (GtkSettings           *settings);
 
 static void gtk_settings_load_from_key_file      (GtkSettings           *settings,
                                                   const gchar           *path,
@@ -1920,6 +1921,7 @@ gtk_settings_get_for_screen (GdkScreen *screen)
       settings_update_cursor_theme (settings);
       settings_update_resolution (settings);
       settings_update_font_options (settings);
+      settings_update_font_name (settings);
     }
 
   return settings;
@@ -3562,7 +3564,7 @@ gtk_settings_get_dnd_drag_threshold (GtkSettings *settings)
 }
 
 static void
-update_font_name (GtkSettings *settings)
+settings_update_font_name (GtkSettings *settings)
 {
   GtkSettingsPrivate *priv = settings->priv;
   GtkSettingsPropertyValue *svalue = &priv->property_values[PROP_FONT_NAME - 1];
@@ -3580,7 +3582,7 @@ update_font_name (GtkSettings *settings)
 const gchar *
 gtk_settings_get_font_family (GtkSettings *settings)
 {
-  update_font_name (settings);
+  settings_update_font_name (settings);
 
   return settings->priv->font_family;
 }
@@ -3588,7 +3590,7 @@ gtk_settings_get_font_family (GtkSettings *settings)
 gint
 gtk_settings_get_font_size (GtkSettings *settings)
 {
-  update_font_name (settings);
+  settings_update_font_name (settings);
 
   return settings->priv->font_size;
 }
@@ -3596,7 +3598,7 @@ gtk_settings_get_font_size (GtkSettings *settings)
 gboolean
 gtk_settings_get_font_size_is_absolute (GtkSettings *settings)
 {
-  update_font_name (settings);
+  settings_update_font_name (settings);
 
   return settings->priv->font_size_absolute;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]