diff options
Diffstat (limited to 'src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch')
-rw-r--r-- | src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch b/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch new file mode 100644 index 00000000..25452c7f --- /dev/null +++ b/src/plugins/pinyin/3rdparty/pinyin/patches/0003-Fix-crash-in-pinyin-ime-if-the-user-dictionary-canno.patch @@ -0,0 +1,41 @@ +From 6fe7d1f903046de1b436d2b34126d595afe2d5cd Mon Sep 17 00:00:00 2001 +From: Jarkko Koivikko <jarkko.koivikko@code-q.fi> +Date: Wed, 8 Apr 2015 13:53:06 +0300 +Subject: [PATCH] Fix crash in pinyin ime if the user dictionary cannot be + opened + +This change fixes a crash caused by dangling pointer. + +The crash happens the next time the user dictionary is flushed after +it fails to open the file. + +Change-Id: If1f51279a8d42f01f08879f0cefcef541d0beff8 +Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com> +--- + src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp +index a3db888..f5f9371 100644 +--- a/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp ++++ b/src/virtualkeyboard/3rdparty/pinyin/share/userdict.cpp +@@ -309,6 +309,7 @@ bool UserDict::load_dict(const char *file_name, LemmaIdType start_id, + return true; + error: + free((void*)dict_file_); ++ dict_file_ = NULL; + start_id_ = 0; + return false; + } +@@ -1021,6 +1022,8 @@ bool UserDict::remove_lemma(LemmaIdType lemma_id) { + + void UserDict::flush_cache() { + LemmaIdType start_id = start_id_; ++ if (!dict_file_) ++ return; + const char * file = strdup(dict_file_); + if (!file) + return; +-- +2.14.1.windows.1 + |