[aseprite] 30/134: Fix crash in SelectAccelerator::KeyField when a Unicode char is pressed

Tobias Hansen thansen at moszumanska.debian.org
Sat Mar 14 17:09:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit ef25706ed2e1412eb25e5cf108b0c1ffd93fe5bd
Author: David Capello <davidcapello at gmail.com>
Date:   Sat Nov 1 15:46:13 2014 -0300

    Fix crash in SelectAccelerator::KeyField when a Unicode char is pressed
    
    The problem is that Accelerator::toString() wasn't returning valid utf-8
    strings for Unicode characters.
---
 src/ui/accelerator.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/ui/accelerator.cpp b/src/ui/accelerator.cpp
index 4892d5f..b9d5179 100644
--- a/src/ui/accelerator.cpp
+++ b/src/ui/accelerator.cpp
@@ -322,8 +322,11 @@ std::string Accelerator::toString() const
   if (m_modifiers & kKeySpaceModifier) buf += "Space+";
 
   // Key
-  if (m_unicodeChar)
-    buf += (wchar_t)toupper(m_unicodeChar);
+  if (m_unicodeChar) {
+    std::wstring wideUnicodeChar;
+    wideUnicodeChar.push_back((wchar_t)toupper(m_unicodeChar));
+    buf += base::to_utf8(wideUnicodeChar);
+  }
   else if (m_scancode && m_scancode > 0 && m_scancode < (int)table_size)
     buf += table[m_scancode];
   else if (!buf.empty() && buf[buf.size()-1] == '+')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list