Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 464173002: Linux: Relanding a patch from an external contributor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes the memory leak. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index 56e485c2059b4572ea3c930494b8dc2701e32711..f9bfc3afda2b0049b042e09493c38f5de259b7b0 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -632,11 +632,24 @@ bool DesktopWindowTreeHostX11::SetWindowTitle(const base::string16& title) {
PropModeReplace,
reinterpret_cast<const unsigned char*>(utf8str.c_str()),
utf8str.size());
- // TODO(erg): This is technically wrong. So XStoreName and friends expect
- // this in Host Portable Character Encoding instead of UTF-8, which I believe
- // is Compound Text. This shouldn't matter 90% of the time since this is the
- // fallback to the UTF8 property above.
- XStoreName(xdisplay_, xwindow_, utf8str.c_str());
+ XTextProperty xtp;
+ char *c_utf8_str = const_cast<char *>(utf8str.c_str());
+ const int err =
+ Xutf8TextListToTextProperty(xdisplay_, &c_utf8_str, 1,
+ XCompoundTextStyle, &xtp);
sadrul 2014/08/13 02:28:19 Looks like XICCEncodingStyle can be = XUTF8StringS
+ if (err != Success) {
+ XFree(xtp.value);
+ const std::string ascii_str = base::UTF16ToASCII(title);
sadrul 2014/08/13 02:28:19 The doc for UTF16ToASCII() states "The result must
+ xtp.encoding = XA_STRING;
+ xtp.format = 8;
+ xtp.value = reinterpret_cast<unsigned char *>
+ (const_cast<char *>(ascii_str.c_str()));
+ xtp.nitems = ascii_str.size();
+ XSetWMName(xdisplay_, xwindow_, &xtp);
+ } else {
+ XSetWMName(xdisplay_, xwindow_, &xtp);
+ XFree(xtp.value);
+ }
return true;
}
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698