Fix crash when libX11 is missing locale support (#2747)

This commit is contained in:
Erin 2023-03-24 01:45:30 +00:00 committed by GitHub
parent 806b629035
commit 4d5db9940f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1757,10 +1757,12 @@ namespace dlib
// it isn't const anymore.
wchar_t *title = const_cast<wchar_t *>(title_.c_str());
XTextProperty property;
XwcTextListToTextProperty(x11_stuff.globals->disp,&title,1,XStdICCTextStyle, &property);
XSetWMName(x11_stuff.globals->disp,x11_stuff.hwnd,&property);
XFree(property.value);
XFlush(x11_stuff.globals->disp);
int rc = XwcTextListToTextProperty(x11_stuff.globals->disp,&title,1,XStdICCTextStyle, &property);
if (rc >= 0) {
XSetWMName(x11_stuff.globals->disp,x11_stuff.hwnd,&property);
XFree(property.value);
XFlush(x11_stuff.globals->disp);
}
}
// ----------------------------------------------------------------------------------------