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

Unified Diff: ui/gfx/text_elider.cc

Issue 2591023004: Fix use-after-scope bug in TextElider. (Closed)
Patch Set: Fix use-after-scope bug in TextElider. Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/text_elider.cc
diff --git a/ui/gfx/text_elider.cc b/ui/gfx/text_elider.cc
index cee598d844222c2417dfb009be75b71836bc76f0..2b22a57a19d0fdab152f50c063cee2293c9e0d2f 100644
--- a/ui/gfx/text_elider.cc
+++ b/ui/gfx/text_elider.cc
@@ -778,7 +778,8 @@ base::string16 TruncateString(const base::string16& string,
icu::Locale::getDefault(), status));
if (U_FAILURE(status))
return string.substr(0, length - 1) + kElideString;
- bi->setText(string.c_str());
+ icu::UnicodeString bi_text(string.c_str());
+ bi->setText(bi_text);
index = bi->preceding(static_cast<int32_t>(length));
if (index == icu::BreakIterator::DONE || index == 0) {
// We either found no valid word break at all, or one right at the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698