Bugfix: Correctly check asprintf() return value
This commit is contained in:
parent
9cf48f17bb
commit
305eac0e71
11
src/window.c
11
src/window.c
|
@ -51,12 +51,21 @@ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop) {
|
||||||
(char*)xcb_get_property_value(prop)) == -1) {
|
(char*)xcb_get_property_value(prop)) == -1) {
|
||||||
perror("asprintf()");
|
perror("asprintf()");
|
||||||
DLOG("Could not get window name\n");
|
DLOG("Could not get window name\n");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
/* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
|
/* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
|
||||||
|
int len;
|
||||||
|
char *ucs2_name = convert_utf8_to_ucs2(new_name, &len);
|
||||||
|
if (ucs2_name == NULL) {
|
||||||
|
LOG("Could not convert _NET_WM_NAME to UCS-2, ignoring new hint\n");
|
||||||
|
FREE(new_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
FREE(win->name_x);
|
FREE(win->name_x);
|
||||||
FREE(win->name_json);
|
FREE(win->name_json);
|
||||||
win->name_json = new_name;
|
win->name_json = new_name;
|
||||||
win->name_x = convert_utf8_to_ucs2(win->name_json, &win->name_len);
|
win->name_x = ucs2_name;
|
||||||
|
win->name_len = len;
|
||||||
LOG("_NET_WM_NAME changed to \"%s\"\n", win->name_json);
|
LOG("_NET_WM_NAME changed to \"%s\"\n", win->name_json);
|
||||||
|
|
||||||
win->uses_net_wm_name = true;
|
win->uses_net_wm_name = true;
|
||||||
|
|
Loading…
Reference in New Issue