GNU bug report logs - #55422
Emacs not starting due to gsettings changes.

Previous Next

Package: emacs;

Reported by: Pankaj Jangid <pankaj <at> codeisgreat.org>

Date: Sun, 15 May 2022 03:21:02 UTC

Severity: normal

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Po Lu <luangruo <at> yahoo.com>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: 55422 <at> debbugs.gnu.org, pieter.van.prooijen <at> teloden.nl
Subject: bug#55422: Emacs not starting due to gsettings changes.
Date: Sun, 15 May 2022 14:49:27 +0800
Pankaj Jangid <pankaj <at> codeisgreat.org> writes:

> Here is the error message. And attached is the stacktrace.

Does this fix the problem?

diff --git a/src/xsettings.c b/src/xsettings.c
index 16625bd229..ba75ea5703 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -230,6 +230,29 @@ #define GSETTINGS_FONT_HINTING       "font-hinting"
 /* The cairo font_options as obtained using gsettings.  */
 static cairo_font_options_t *font_options;
 
+static bool
+xg_settings_key_valid_p (GSettings *settings, const char *key)
+{
+#ifdef GLIB_VERSION_2_32
+  GSettingsSchema *schema;
+  bool rc;
+
+  g_object_get (G_OBJECT (settings),
+		"settings-schema", &schema,
+		NULL);
+
+  if (!schema)
+    return false;
+
+  rc = g_settings_schema_has_key (schema, key);
+  g_settings_schema_unref (schema);
+
+  return rc;
+#else
+  return false;
+#endif
+}
+
 /* Store an event for re-rendering of the fonts.  */
 static void
 store_font_options_changed (void)
@@ -243,13 +266,21 @@ store_font_options_changed (void)
 static void
 apply_gsettings_font_hinting (GSettings *settings)
 {
-  GVariant *val = g_settings_get_value (settings, GSETTINGS_FONT_HINTING);
+  GVariant *val;
+  const char *hinting;
+
+  if (!xg_settings_key_valid_p (settings, GSETTINGS_FONT_HINTING))
+    return;
+
+  val = g_settings_get_value (settings, GSETTINGS_FONT_HINTING);
+
   if (val)
     {
       g_variant_ref_sink (val);
+
       if (g_variant_is_of_type (val, G_VARIANT_TYPE_STRING))
 	{
-	  const char *hinting = g_variant_get_string (val, NULL);
+	  hinting = g_variant_get_string (val, NULL);
 
 	  if (!strcmp (hinting, "full"))
 	    cairo_font_options_set_hint_style (font_options,
@@ -268,29 +299,6 @@ apply_gsettings_font_hinting (GSettings *settings)
     }
 }
 
-static bool
-xg_settings_key_valid_p (GSettings *settings, const char *key)
-{
-#ifdef GLIB_VERSION_2_32
-  GSettingsSchema *schema;
-  bool rc;
-
-  g_object_get (G_OBJECT (settings),
-		"settings-schema", &schema,
-		NULL);
-
-  if (!schema)
-    return false;
-
-  rc = g_settings_schema_has_key (schema, key);
-  g_settings_schema_unref (schema);
-
-  return rc;
-#else
-  return false;
-#endif
-}
-
 /* Apply changes in the antialiasing system setting.  */
 static void
 apply_gsettings_font_antialias (GSettings *settings)




This bug report was last modified 3 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.