Re: [dev] Fix for dwm crash due to emoji in window titles

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 19 Jul 2018 17:41:16 +0200

On Thu, Jul 19, 2018 at 02:19:43AM +0300, Alexander Krotov wrote:
> From time to time there are threads about the bug in dwm that make it
> crash when it cannot render some glyphs in window titles (usually
> emoji).
> Here is a way to reproduce the bug:
> [1]https://lists.suckless.org/dev/1608/30274.html
> Here is an attempt to fix the bug that makes dwm freeze:
> [2]https://lists.suckless.org/dev/1802/32534.html
> Attached is a patch that fixes the bug for me. With it applied the
> symbol is simply not rendered (while other symbols are) and dwm
> continues to be usable.
> It fixes both the crash due to symbols in the window title and due to
> symbols in the status bar (xsetroot -name).
> I do not understand xlib and Xft enough to make a more clean fix, but
> hopefully maintainers can improve it and apply to the mainline.
> Meanwhile, dwm users can use this workaround.
>
> References
>
> 1. https://lists.suckless.org/dev/1608/30274.html
> 2. https://lists.suckless.org/dev/1802/32534.html

> From 99e82a4d44650c98edb17836fcef743cc87a614a Mon Sep 17 00:00:00 2001
> From: Alexander Krotov <ilabdsf_AT_gmail.com>
> Date: Thu, 19 Jul 2018 02:10:28 +0300
> Subject: [PATCH] Ignore Xft errors when drawing text
>
> ---
> dwm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/dwm.c b/dwm.c
> index 4465af1..63a9df1 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -731,7 +731,11 @@ drawbar(Monitor *m)
> if ((w = m->ww - sw - x) > bh) {
> if (m->sel) {
> drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
> + XSetErrorHandler(xerrordummy);
> drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
> + XSync(dpy, False);
> + XSetErrorHandler(xerror);
> +
> if (m->sel->isfloating)
> drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
> } else {
> --
> 2.18.0
>

It is not a fix, it will just ignore the error.

The emoji crash is a bug in Xft.

-- 
Kind regards,
Hiltjo
Received on Thu Jul 19 2018 - 17:41:16 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 19 2018 - 17:48:07 CEST