unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>, npostavs@users.sourceforge.net
Cc: 23386@debbugs.gnu.org
Subject: bug#23386: Segfault when messing with font-backend
Date: Tue, 12 Jul 2016 18:20:41 +0300	[thread overview]
Message-ID: <86d31541-774c-3605-41b7-2aae0efd7abb@yandex.ru> (raw)
In-Reply-To: <831t30dz2e.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

On 07/11/2016 05:33 PM, Eli Zaretskii wrote:

> But it doesn't do what the user asked for.
>
> I don't see why it would be meaningless to evict a backend and start
> using another one, if all it takes is re-open a bunch of fonts.

OK, the following patch basically works for me (not tested too much, BTW).

Dmitry



[-- Attachment #2: bug23386.patch --]
[-- Type: text/x-diff, Size: 2222 bytes --]

diff --git a/src/dispextern.h b/src/dispextern.h
index c2fcca5..88b4077 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3605,6 +3605,7 @@ extern Lisp_Object x_default_parameter (struct frame *, Lisp_Object,
                                         Lisp_Object, Lisp_Object,
                                         const char *, const char *,
                                         enum resource_types);
+extern void x_default_font_parameter (struct frame *, Lisp_Object);
 extern char *x_get_string_resource (XrmDatabase, const char *,
 				    const char *);
 
diff --git a/src/frame.c b/src/frame.c
index 80e181f..40d2d32 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3712,7 +3712,11 @@ 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);
+    {
+      Lisp_Object frame;
+      XSETFRAME (frame, f);
+      free_all_realized_faces (frame);
+    }
 
   new_value = font_update_drivers (f, NILP (new_value) ? Qt : new_value);
   if (NILP (new_value))
@@ -3726,10 +3730,8 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
 
   if (FRAME_FONT (f))
     {
-      Lisp_Object frame;
-
-      XSETFRAME (frame, f);
-      x_set_font (f, Fframe_parameter (frame, Qfont), Qnil);
+      /* Reconsider default font after backend(s) change (Bug#23386).  */
+      x_default_font_parameter (f, Qnil);
       face_change = true;
       windows_or_buffers_changed = 18;
     }
diff --git a/src/w32fns.c b/src/w32fns.c
index 0eb720e..cffa8c0 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5249,7 +5249,7 @@ do_unwind_create_frame (Lisp_Object frame)
   unwind_create_frame (frame);
 }
 
-static void
+void
 x_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
diff --git a/src/xfns.c b/src/xfns.c
index 16dbcfd..fcd3886 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3065,7 +3065,7 @@ do_unwind_create_frame (Lisp_Object frame)
   unwind_create_frame (frame);
 }
 
-static void
+void
 x_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);

  reply	other threads:[~2016-07-12 15:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 13:13 bug#23386: Segfault when messing with font-backend Stefan Monnier
2016-04-27 14:02 ` Eli Zaretskii
2016-04-27 14:23   ` Stefan Monnier
2016-07-09 19:11     ` npostavs
2016-07-09 20:02       ` npostavs
2016-07-10 14:18         ` Eli Zaretskii
2016-07-10 20:15           ` npostavs
2016-07-10 17:29       ` Dmitry Antipov
2016-07-10 20:17         ` npostavs
2016-07-11 14:33           ` Eli Zaretskii
2016-07-12 15:20             ` Dmitry Antipov [this message]
2016-07-12 17:45               ` Eli Zaretskii
2016-07-12 17:58                 ` Dmitry Antipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86d31541-774c-3605-41b7-2aae0efd7abb@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=23386@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).