summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2013-02-13 14:58:55 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2013-03-04 23:15:29 +0000
commit7d1ff9240485d0b8b3d676c112aca8c9667a084e (patch)
treec7c41415d5303d8e8e4cd4ba3109ae6069c5898d
parentd79204ec2764c01c891d88ace0ab6f95f0a3e5c1 (diff)
downloadclutter-7d1ff9240485d0b8b3d676c112aca8c9667a084e.tar.gz
settings: Don't reload config for fontconfig if there's no fontmap
If anything in the system changes the config for fontconfig then an XSetting will be set to record the last timestamp of the config file. This is presumably so that applications can be notified that it has changed and can reload the configuration. However once this setting is set it will remain set for the lifetime of the X server. This causes Clutter to handle the setting during the initialisation of the backend. Previously this would cause problems because Clutter would end up creating the default PangoFontMap before the backend has created the CoglContext. The PangoFontMap would in turn cause the default CoglContext to be created. Clutter will then later create its own CoglContext which means there will be two and the first one will be leaked. Cogl currently can't really cope with multiple contexts being created so it falls apart. This patch fixes it to skip reloading the config for fontconfig if there isn't a default font map yet. The config will presumably naturally be read with the latest values when it is finally created anyway so it doesn't need to be read immediately. https://bugzilla.gnome.org/show_bug.cgi?id=693696 (cherry picked from commit 4b92d656c2b63570b91105f05b863c4efed32134) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-rw-r--r--clutter/clutter-settings.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/clutter/clutter-settings.c b/clutter/clutter-settings.c
index 45d4f299c..55a155b84 100644
--- a/clutter/clutter-settings.c
+++ b/clutter/clutter-settings.c
@@ -216,18 +216,26 @@ settings_update_fontmap (ClutterSettings *self,
if (self->last_fontconfig_timestamp != stamp)
{
- PangoFontMap *fontmap;
+ ClutterMainContext *context;
gboolean update_needed = FALSE;
- fontmap = clutter_get_font_map ();
+ context = _clutter_context_get_default ();
- if (PANGO_IS_FC_FONT_MAP (fontmap) &&
- !FcConfigUptoDate (NULL))
+ /* If there is no font map yet then we don't need to do anything
+ * because the config for fontconfig will be read when it is
+ * created */
+ if (context->font_map)
{
- pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
+ PangoFontMap *fontmap = PANGO_FONT_MAP (context->font_map);
- if (FcInitReinitialize ())
- update_needed = TRUE;
+ if (PANGO_IS_FC_FONT_MAP (fontmap) &&
+ !FcConfigUptoDate (NULL))
+ {
+ pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (fontmap));
+
+ if (FcInitReinitialize ())
+ update_needed = TRUE;
+ }
}
self->last_fontconfig_timestamp = stamp;