I have reduced dmenu segfault down to a simple program:
https://bugs.freedesktop.org/show_bug.cgi?id=107531
Please read the program and see if you can tell what is wrong or
confirm a bug. Apparently the bug is in fontconfig.
Running dwm with "pango" patch doesn't help either, so I think the
problem is in fontconfig and not Xft.
Also there are many bugfixes since 2.13.0 related to null ponter
dereferences, so maybe the bug is already fixed:
https://cgit.freedesktop.org/fontconfig/log/
/*
gcc bug.c -lX11 -lXft -I /usr/include/freetype2 -lfontconfig
*/
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>
int main(void) {
Display *dpy = XOpenDisplay(NULL);
if(dpy == NULL)
return 1;
int screen = DefaultScreen(dpy);
char *fontname = "monospace:size=10";
XftFont *xfont = XftFontOpenName(dpy, screen, fontname);
if(xfont == NULL) {
printf("Can't load font pattern");
return 1;
}
FcPattern *pattern = FcNameParse((FcChar8 *) fontname);
if (pattern == NULL) {
printf("Can't parse name to pattern");
return 1;
}
long utf8codepoint = 0x1F4D3; // notebook emoji
FcCharSet *fccharset = FcCharSetCreate ();
FcCharSetAddChar(fccharset, utf8codepoint);
FcPatternAddCharSet(pattern, FC_CHARSET, fccharset);
FcPatternAddBool(pattern, FC_SCALABLE, FcTrue);
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
// drw.c uses XftFontMatch here
FcFontMatch (NULL, pattern, &result);
XCloseDisplay(dpy);
}