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

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

bug#39865: 28.0.50; Emacs crash


From: Robert Pluim
Subject: bug#39865: 28.0.50; Emacs crash
Date: Fri, 13 Mar 2020 10:35:14 +0100

>>>>> On Thu, 12 Mar 2020 21:44:15 -0300, Vinicius José Latorre 
>>>>> <address@hidden> said:

    >> Vinicius, the following patch should fix things for you.
    Vinicius> I've just reinstalled with the fix, and I confirm that all works 
right when
    Vinicius> setting font-backend to xft.

Thanks for testing.

Eli, the patch as it stands is not suitable for pushing to emacs-27,
since it breaks the macOS build, which doesnʼt have a
gui_default_font_parameter function. As far as I can tell (and have
tested :-) ), we can get away with a dummy one, since there is only
one font backend on macOS. If you agree, this is what the complete
patch looks like:

diff --git a/src/dispextern.h b/src/dispextern.h
index 6246c7c080..f08231f071 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3726,6 +3726,7 @@ #define IMAGE_BACKGROUND_TRANSPARENT(img, f, mask)        
                      \
                                           Lisp_Object, Lisp_Object,
                                           const char *, const char *,
                                           enum resource_types);
+extern void gui_default_font_parameter (struct frame *, Lisp_Object);
 
 #ifndef HAVE_NS /* These both used on W32 and X only.  */
 extern bool gui_mouse_grabbed (Display_Info *);
diff --git a/src/frame.c b/src/frame.c
index 51fc78ab70..45fed8420c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4565,7 +4565,11 @@ gui_set_font_backend (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_va
     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))
@@ -4579,10 +4583,8 @@ gui_set_font_backend (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_va
 
   if (FRAME_FONT (f))
     {
-      Lisp_Object frame;
-
-      XSETFRAME (frame, f);
-      gui_set_font (f, Fframe_parameter (frame, Qfont), Qnil);
+      /* Reconsider default font after backend(s) change (Bug#23386).  */
+      gui_default_font_parameter (f, Qnil);
       face_change = true;
       windows_or_buffers_changed = 18;
     }
diff --git a/src/nsfns.m b/src/nsfns.m
index cbde93b3f1..b7f6813e4f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1447,6 +1447,14 @@ Turn the input menu (an NSMenu) into a lisp list for 
tracking on lisp side.
   return unbind_to (count, frame);
 }
 
+/* This currently does nothing, since it's only really needed when
+   changing the font-backend, but macOS currently only has one
+   possible backend.  */
+void
+gui_default_font_parameter (struct frame *f, Lisp_Object parms)
+{
+}
+
 static BOOL
 ns_window_is_ancestor (NSWindow *win, NSWindow *candidate)
 /* Test whether CANDIDATE is an ancestor window of WIN.  */
diff --git a/src/w32fns.c b/src/w32fns.c
index 61e22e5700..c09e14d354 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5749,8 +5749,8 @@ do_unwind_create_frame (Lisp_Object frame)
   unwind_create_frame (frame);
 }
 
-static void
-w32_default_font_parameter (struct frame *f, Lisp_Object parms)
+void
+gui_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   Lisp_Object font_param = gui_display_get_arg (dpyinfo,
@@ -5978,7 +5978,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
 
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
-  w32_default_font_parameter (f, parameters);
+  gui_default_font_parameter (f, parameters);
 
   /* Default BorderWidth to 0 to match other platforms.  */
   gui_default_parameter (f, parameters, Qborder_width, make_fixnum (0),
@@ -7039,7 +7039,7 @@ w32_create_tip_frame (struct w32_display_info *dpyinfo, 
Lisp_Object parms)
 
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
-  w32_default_font_parameter (f, parms);
+  gui_default_font_parameter (f, parms);
 
   gui_default_parameter (f, parms, Qborder_width, make_fixnum (2),
                          "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
diff --git a/src/xfns.c b/src/xfns.c
index 5758bb7a18..ab013d85d8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3555,8 +3555,8 @@ do_unwind_create_frame (Lisp_Object frame)
   unwind_create_frame (frame);
 }
 
-static void
-x_default_font_parameter (struct frame *f, Lisp_Object parms)
+void
+gui_default_font_parameter (struct frame *f, Lisp_Object parms)
 {
   struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   Lisp_Object font_param = gui_display_get_arg (dpyinfo, parms, Qfont, NULL, 
NULL,
@@ -3894,7 +3894,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
 
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
-  x_default_font_parameter (f, parms);
+  gui_default_font_parameter (f, parms);
   if (!FRAME_FONT (f))
     {
       delete_frame (frame, Qnoelisp);
@@ -6378,7 +6378,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, 
Lisp_Object parms)
 
   /* Extract the window parameters from the supplied values that are
      needed to determine window geometry.  */
-  x_default_font_parameter (f, parms);
+  gui_default_font_parameter (f, parms);
 
   gui_default_parameter (f, parms, Qborder_width, make_fixnum (0),
                          "borderWidth", "BorderWidth", RES_TYPE_NUMBER);





reply via email to

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