From: Joris Klaasse Bos <[email protected]>
Before this commit, running st on a system with musl libc would
result in a segmentation fault. This is because musl implements
locales differently, which means the function
Xutf8TextListToTextProperty would fail, because the locale isn't
supported, leading to nonexistent memory being freed.
I've fixed this by checking if the locale is supported and using
XStringListToTextProperty otherwise.
---
x.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/x.c b/x.c
index 210f184..a9632cb 100644
--- a/x.c
+++ b/x.c
@@ -1585,8 +1585,11 @@ xsettitle(char *p)
XTextProperty prop;
DEFAULT(p, opt_title);
- Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
- &prop);
+ if (XSupportsLocale())
+ Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop);
+ else
+ XStringListToTextProperty(&p, 1, &prop);
XSetWMName(xw.dpy, xw.win, &prop);
XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
XFree(prop.value);
--
2.27.0