>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:
https://lists.suckless.org/dev/1608/30274.html

Here is an attempt to fix the bug that makes dwm freeze:
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.
From 99e82a4d44650c98edb17836fcef743cc87a614a Mon Sep 17 00:00:00 2001
From: Alexander Krotov <ilab...@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
@@ -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

Reply via email to