aboutsummaryrefslogtreecommitdiff
path: root/src/Xutil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xutil.cc')
-rw-r--r--src/Xutil.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Xutil.cc b/src/Xutil.cc
index c138142..4d4dbc2 100644
--- a/src/Xutil.cc
+++ b/src/Xutil.cc
@@ -51,8 +51,8 @@ FbTk::FbString getWMName(Window window) {
51 51
52 XTextProperty text_prop; 52 XTextProperty text_prop;
53 text_prop.value = 0; 53 text_prop.value = 0;
54 char **list; 54 char **list = 0;
55 int num; 55 int num = 0;
56 _FB_USES_NLS; 56 _FB_USES_NLS;
57 string name; 57 string name;
58 58
@@ -61,15 +61,16 @@ FbTk::FbString getWMName(Window window) {
61 if (text_prop.encoding != XA_STRING) { 61 if (text_prop.encoding != XA_STRING) {
62 62
63 text_prop.nitems = strlen((char *) text_prop.value); 63 text_prop.nitems = strlen((char *) text_prop.value);
64 XmbTextPropertyToTextList(display, &text_prop, &list, &num);
64 65
65 if ((XmbTextPropertyToTextList(display, &text_prop, 66 if (num > 0 && list != 0)
66 &list, &num) == Success) &&
67 (num > 0) && *list) {
68 name = FbTk::FbStringUtil::LocaleStrToFb(static_cast<char *>(*list)); 67 name = FbTk::FbStringUtil::LocaleStrToFb(static_cast<char *>(*list));
69 XFreeStringList(list); 68 else
70 } else
71 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; 69 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
72 70
71 if (list)
72 XFreeStringList(list);
73
73 } else 74 } else
74 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; 75 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
75 76