GNU bug report logs - #23386
Segfault when messing with font-backend

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Date: Wed, 27 Apr 2016 13:14:01 UTC

Severity: normal

Tags: confirmed

Merged with 35803, 36835, 39865

Found in versions 25.0.95, 28.0.50, 25.0.50, 24.1, 24.5, 26.2, 27.0.50

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Antipov <dmantipov <at> yandex.ru>
To: npostavs <at> users.sourceforge.net, Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 23386 <at> debbugs.gnu.org
Subject: bug#23386: Segfault when messing with font-backend
Date: Sun, 10 Jul 2016 20:29:59 +0300
On 07/09/2016 10:11 PM, npostavs <at> users.sourceforge.net wrote:

> Here is a patch that attempts to fix the issue by resetting the font
> after the backend is changed.  It does let Emacs successfully open the
> frame with the new font (no funny box characters in the modeline), but
> I'm not sure if it's the best way of marking the font object invalid.

IMHO the original trick (request to drop font backend when there is a font
opened by using this backend) is practically meaningless, so why just not
prohibit it explicitly? For example, with:

diff --git a/src/frame.c b/src/frame.c
index 22143ab..d8f89ed 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3708,7 +3708,19 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
     return;

   if (FRAME_FONT (f))
-    free_all_realized_faces (Qnil);
+    {
+      if (!NILP (new_value))
+	{
+	  Lisp_Object backend = FRAME_FONT (f)->props[FONT_TYPE_INDEX];
+
+	  /* Do not release the backend used by F's default font.  */
+	  if (NILP (Fmemq (backend, new_value)))
+	    error ("Font backend '%s' is in use by font '%s'",
+		   SDATA (SYMBOL_NAME (backend)),
+		   SDATA (FRAME_FONT (f)->props[FONT_NAME_INDEX]));
+	}
+      free_all_realized_faces (Qnil);
+    }

   new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value);
   if (NILP (new_value))

Dmitry




This bug report was last modified 5 years and 64 days ago.

Previous Next


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