[Top][All Lists]

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

bug#39662: 28.0.50; Emacs crashes in x_cr_define_fringe_bitmap if (fring

From: Robert Pluim
Subject: bug#39662: 28.0.50; Emacs crashes in x_cr_define_fringe_bitmap if (fringe-mode 0)
Date: Tue, 18 Feb 2020 16:45:20 +0100

>>>>> On Tue, 18 Feb 2020 16:06:19 +0100, Thibault Polge <address@hidden> said:

    Thibault> Emacs built from commit b519d515bac8bd8c1265fe3965a51be249581817, 
    Thibault> GNU/Linux, with the Lucid or GTK3 toolkits (haven't tried anything
    Thibault> else), will crash eval'ing this snippet:

    Thibault> (progn
    Thibault>   (package-initialize)
    Thibault>   (package-install 'diff-hl)
    Thibault>   (fringe-mode 0)
    Thibault>   (dired "~")
    Thibault>   (diff-hl-dired-mode 1))

Yes, if fringe-mode is disabled the width calculated by diff-hl for
the bitmap is zero, which x_cr_define_fringe_bitmap doesn╩╝t like.

Does this bandaid fix it for you? It will still crash if you later
re-enable fringe-mode. Perhaps we should signal an error for this case
and have diff-hl deal with the fallout? (define-fringe-bitmap
docstring says the width has to be from 1-16).

diff --git a/src/xterm.c b/src/xterm.c
index 21d99f0c7b..7836a57fc6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -552,6 +552,9 @@ x_end_cr_xlib_drawable (struct frame *f, GC gc)
 static void
 x_cr_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd)
+  if (h == 0 || wd == 0)
+    return;
   int i, stride;
   cairo_surface_t *surface;
   cairo_pattern_t *pattern;

reply via email to

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