summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ZYLibZhuyin.cc3
-rw-r--r--src/ZYZPinyinEditor.cc3
-rw-r--r--src/ZYZZhuyinEditor.cc3
-rw-r--r--src/ZYZZhuyinEngine.cc3
4 files changed, 9 insertions, 3 deletions
diff --git a/src/ZYLibZhuyin.cc b/src/ZYLibZhuyin.cc
index eb4dc64..190d3da 100644
--- a/src/ZYLibZhuyin.cc
+++ b/src/ZYLibZhuyin.cc
@@ -111,7 +111,8 @@ LibZhuyinBackEnd::allocZhuyinInstance ()
void
LibZhuyinBackEnd::freeZhuyinInstance (zhuyin_instance_t *instance)
{
- zhuyin_free_instance (instance);
+ if (instance)
+ zhuyin_free_instance (instance);
}
void
diff --git a/src/ZYZPinyinEditor.cc b/src/ZYZPinyinEditor.cc
index dd4adf7..0416b85 100644
--- a/src/ZYZPinyinEditor.cc
+++ b/src/ZYZPinyinEditor.cc
@@ -134,7 +134,8 @@ PinyinEditor::updatePreeditText (void)
char * sentence = NULL;
zhuyin_get_sentence (instance, &sentence);
- m_preedit_text += sentence;
+ if (sentence)
+ m_preedit_text += sentence;
g_free (sentence);
size_t len = zhuyin_get_parsed_input_length (instance);
diff --git a/src/ZYZZhuyinEditor.cc b/src/ZYZZhuyinEditor.cc
index a0bb2eb..712b59f 100644
--- a/src/ZYZZhuyinEditor.cc
+++ b/src/ZYZZhuyinEditor.cc
@@ -131,7 +131,8 @@ ZhuyinEditor::updatePreeditText (void)
char * sentence = NULL;
zhuyin_get_sentence (instance, &sentence);
- m_preedit_text += sentence;
+ if (sentence)
+ m_preedit_text += sentence;
g_free (sentence);
size_t len = zhuyin_get_parsed_input_length (instance);
diff --git a/src/ZYZZhuyinEngine.cc b/src/ZYZZhuyinEngine.cc
index 5887076..399b3b0 100644
--- a/src/ZYZZhuyinEngine.cc
+++ b/src/ZYZZhuyinEngine.cc
@@ -108,6 +108,9 @@ ZhuyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers)
return TRUE;
}
+ } else {
+ /* skip the key press event. */
+ return TRUE;
}
retval = m_editors[m_input_mode]->processKeyEvent (keyval, keycode, modifiers);