diff --git a/src/IBusChewingLookupTable.c b/src/IBusChewingLookupTable.c index 167a3e8..0e9ef6a 100644 --- a/src/IBusChewingLookupTable.c +++ b/src/IBusChewingLookupTable.c @@ -6,16 +6,14 @@ IBusLookupTable *ibus_chewing_lookup_table_new(ChewingContext *context) { guint size = 10; gboolean cursorShow = TRUE; gboolean wrapAround = TRUE; - IBusLookupTable *iTable = - ibus_lookup_table_new(size, 0, cursorShow, wrapAround); + IBusLookupTable *iTable = ibus_lookup_table_new(size, 0, cursorShow, wrapAround); ibus_chewing_lookup_table_resize(iTable, context); return iTable; } -void ibus_chewing_lookup_table_resize(IBusLookupTable *iTable, - ChewingContext *context) { +void ibus_chewing_lookup_table_resize(IBusLookupTable *iTable, ChewingContext *context) { gint selKSym[MAX_SELKEY]; g_autoptr(GSettings) settings = g_settings_new(QUOTE_ME(PROJECT_SCHEMA_ID)); g_autofree char *selKeyStr = g_settings_get_string(settings, "sel-keys"); @@ -34,8 +32,7 @@ void ibus_chewing_lookup_table_resize(IBusLookupTable *iTable, for (i = 0; i < len; i++) { selKSym[i] = (gint)selKeyStr[i]; - iText = g_object_ref_sink( - ibus_text_new_from_printf("%c.", toupper(selKeyStr[i]))); + iText = g_object_ref_sink(ibus_text_new_from_printf("%c.", toupper(selKeyStr[i]))); ibus_lookup_table_set_label(iTable, i, iText); g_object_unref(iText); } @@ -43,14 +40,12 @@ void ibus_chewing_lookup_table_resize(IBusLookupTable *iTable, chewing_set_candPerPage(context, len); chewing_set_selKey(context, selKSym, len); - gboolean verticalLookupTable = - g_settings_get_boolean(settings, "vertical-lookup-table"); + gboolean verticalLookupTable = g_settings_get_boolean(settings, "vertical-lookup-table"); ibus_lookup_table_set_orientation(iTable, verticalLookupTable); } -guint ibus_chewing_lookup_table_update(IBusLookupTable *iTable, - ChewingContext *context) { +guint ibus_chewing_lookup_table_update(IBusLookupTable *iTable, ChewingContext *context) { IBusText *iText = NULL; gint i; gint choicePerPage = chewing_cand_ChoicePerPage(context); @@ -70,7 +65,7 @@ guint ibus_chewing_lookup_table_update(IBusLookupTable *iTable, iText = g_object_ref_sink(ibus_text_new_from_string(candidate)); ibus_lookup_table_append_candidate(iTable, iText); - g_free(candidate); + chewing_free(candidate); g_object_unref(iText); } else { break; diff --git a/src/IBusChewingPreEdit.c b/src/IBusChewingPreEdit.c index 646af7f..c8101b8 100644 --- a/src/IBusChewingPreEdit.c +++ b/src/IBusChewingPreEdit.c @@ -39,6 +39,7 @@ void ibus_chewing_pre_edit_free(IBusChewingPreEdit *self) { } gchar *ibus_chewing_pre_edit_get_bopomofo_string(IBusChewingPreEdit *self) { + // FIXME: libchewing should provide chewing_bopomofo_String(ctx) const gchar *buf = chewing_bopomofo_String_static(self->context); return g_strdup(buf); @@ -94,7 +95,7 @@ void ibus_chewing_pre_edit_update(IBusChewingPreEdit *self) { self->wordLen = i + self->bpmfLen; - g_free(bufferStr); + chewing_free(bufferStr); g_free(bpmfStr); ibus_chewing_pre_edit_update_outgoing(self); diff --git a/src/ibus-chewing-engine.c b/src/ibus-chewing-engine.c index cba73f0..137de58 100644 --- a/src/ibus-chewing-engine.c +++ b/src/ibus-chewing-engine.c @@ -950,7 +950,7 @@ void refresh_aux_text(IBusChewingEngine *self) { IBUS_CHEWING_LOG(INFO, "update_aux_text() auxStr=%s", auxStr); self->auxText = g_object_ref_sink(ibus_text_new_from_string(auxStr)); - g_free(auxStr); + chewing_free(auxStr); } else if (self->prop_notify_mode_change && self->pending_notify_chinese_english_mode) { self->pending_notify_chinese_english_mode = FALSE; char *auxStr = is_chinese_mode(self) ? _("Chinese Mode") : _("English Mode"); @@ -1073,7 +1073,7 @@ void ibus_chewing_engine_candidate_clicked(IBusEngine *engine, guint index, guin KSym k = (KSym)selKeys[index]; ibus_chewing_pre_edit_process_key(self->icPreEdit, k, 0); - g_free(selKeys); + chewing_free(selKeys); ibus_chewing_engine_update(self); } else { IBUS_CHEWING_LOG(DEBUG, "candidate_clicked() ... candidates are not showing");