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

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

bug#38564: 27.0.50; macOS "emacs -nw" git-gutter-mode segfault


From: Robert Pluim
Subject: bug#38564: 27.0.50; macOS "emacs -nw" git-gutter-mode segfault
Date: Fri, 20 Dec 2019 12:47:48 +0100

>>>>> On Thu, 19 Dec 2019 19:14:16 +0000, Alan Third <alan@idiocy.org> said:

    Alan> On Thu, Dec 19, 2019 at 10:03:53AM -0800, Mike Hamrick wrote:
    >> Heya folks,
    >> 
    >> I believe I'm still experiencing a version of this same bug. I'm not
    >> always able to reproduce it unfortunately, but it often happens when
    >> viewing git logs in Magit with 'll'. Again, terminal frame with the 'ns'
    >> version of emacs 27.

    Alan> Robert hasn’t pushed his updated version of this fix, and it now
    Alan> occurs to me that he may have been waiting for me to review it...

I was, but I thought the previous version should work as well. Hmm, is
FRAME_DISPLAY_INFO guaranteed to be initialized?

Mike, could you try the following?

diff --git i/src/dispextern.h w/src/dispextern.h
index 0615b16d71..4bf9f39cd0 100644
--- i/src/dispextern.h
+++ w/src/dispextern.h
@@ -123,7 +123,9 @@ #define NativeRectangle XRectangle
 
 #ifdef HAVE_NS
 #include "nsgui.h"
-#define FACE_COLOR_TO_PIXEL(face_color, frame) 
ns_color_index_to_rgba(face_color, frame)
+#define FACE_COLOR_TO_PIXEL(face_color, frame) (FRAME_NS_P (frame) \
+                                                ? ns_color_index_to_rgba 
(face_color, frame) \
+                                                : face_color)
 /* Following typedef needed to accommodate the MSDOS port, believe it or not.  
*/
 typedef struct ns_display_info Display_Info;
 typedef Emacs_Pixmap Emacs_Pix_Container;
diff --git i/src/nsterm.m w/src/nsterm.m
index 6995577920..c415159890 100644
--- i/src/nsterm.m
+++ w/src/nsterm.m
@@ -2290,24 +2290,19 @@ so some key presses (TAB) are swallowed by the system.  
*/
 
 /* Convert an index into the color table into an RGBA value.  Used in
    xdisp.c:extend_face_to_end_of_line when comparing faces and frame
-   color values.  No-op on non-gui frames.  */
+   color values.  */
 
 unsigned long
 ns_color_index_to_rgba(int idx, struct frame *f)
 {
-  if (FRAME_DISPLAY_INFO (f))
-    {
-      NSColor *col;
-      col = ns_lookup_indexed_color (idx, f);
+  NSColor *col;
+  col = ns_lookup_indexed_color (idx, f);
 
-      EmacsCGFloat r, g, b, a;
-      [col getRed: &r green: &g blue: &b alpha: &a];
+  EmacsCGFloat r, g, b, a;
+  [col getRed: &r green: &g blue: &b alpha: &a];
 
-      return ARGB_TO_ULONG((int)(a*255),
-                           (int)(r*255), (int)(g*255), (int)(b*255));
-    }
-  else
-    return idx;
+  return ARGB_TO_ULONG((int)(a*255),
+                       (int)(r*255), (int)(g*255), (int)(b*255));
 }
 
 void






reply via email to

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