XGetWindowProperty() can report success but still give you a NULL pointer.
Thanks to Joseph Toppi for the fix! --HG-- extra : rebase_source : c450494b2c2e397098e50b621b01895fc587357f
This commit is contained in:
parent
57bc440ba9
commit
20181eb52a
1 changed files with 2 additions and 2 deletions
|
@ -593,14 +593,14 @@ X11_GetWindowTitle(_THIS, Window xwindow)
|
|||
status = XGetWindowProperty(display, xwindow, data->_NET_WM_NAME,
|
||||
0L, 8192L, False, data->UTF8_STRING, &real_type, &real_format,
|
||||
&items_read, &items_left, &propdata);
|
||||
if (status == Success) {
|
||||
if (status == Success && propdata) {
|
||||
title = SDL_strdup(SDL_static_cast(char*, propdata));
|
||||
XFree(propdata);
|
||||
} else {
|
||||
status = XGetWindowProperty(display, xwindow, XA_WM_NAME,
|
||||
0L, 8192L, False, XA_STRING, &real_type, &real_format,
|
||||
&items_read, &items_left, &propdata);
|
||||
if (status == Success) {
|
||||
if (status == Success && propdata) {
|
||||
title = SDL_iconv_string("UTF-8", "", SDL_static_cast(char*, propdata), items_read+1);
|
||||
} else {
|
||||
title = SDL_strdup("");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue