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 c2fb71f..6a12071 100644
--- a/src/Xutil.cc
+++ b/src/Xutil.cc
@@ -56,8 +56,8 @@ FbTk::FbString getWMName(Window window) {
56 56
57 XTextProperty text_prop; 57 XTextProperty text_prop;
58 text_prop.value = 0; 58 text_prop.value = 0;
59 char **list; 59 char **list = 0;
60 int num; 60 int num = 0;
61 _FB_USES_NLS; 61 _FB_USES_NLS;
62 string name; 62 string name;
63 63
@@ -66,15 +66,16 @@ FbTk::FbString getWMName(Window window) {
66 if (text_prop.encoding != XA_STRING) { 66 if (text_prop.encoding != XA_STRING) {
67 67
68 text_prop.nitems = strlen((char *) text_prop.value); 68 text_prop.nitems = strlen((char *) text_prop.value);
69 XmbTextPropertyToTextList(display, &text_prop, &list, &num);
69 70
70 if ((XmbTextPropertyToTextList(display, &text_prop, 71 if (num > 0 && list != 0)
71 &list, &num) == Success) &&
72 (num > 0) && *list) {
73 name = FbTk::FbStringUtil::LocaleStrToFb(static_cast<char *>(*list)); 72 name = FbTk::FbStringUtil::LocaleStrToFb(static_cast<char *>(*list));
74 XFreeStringList(list); 73 else
75 } else
76 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; 74 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
77 75
76 if (list)
77 XFreeStringList(list);
78
78 } else 79 } else
79 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : ""; 80 name = text_prop.value ? FbTk::FbStringUtil::XStrToFb((char *)text_prop.value) : "";
80 81