bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23386: Segfault when messing with font-backend


From: Dmitry Antipov
Subject: bug#23386: Segfault when messing with font-backend
Date: Sun, 10 Jul 2016 20:29:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 07/09/2016 10:11 PM, npostavs@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]