[evolution/webkit-composer] Bug #689633 - Crash when attempting interactive spell check



commit 061b4683645d129b5af6e5abc14081b0ed24fa8c
Author: Dan VrÃtil <dvratil redhat com>
Date:   Sun Dec 9 23:16:42 2012 +0100

    Bug #689633 - Crash when attempting interactive spell check

 e-util/e-spell-dictionary.c                  |    2 +-
 widgets/editor/e-editor-spell-check-dialog.c |   27 ++++++++++++-------------
 2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/e-util/e-spell-dictionary.c b/e-util/e-spell-dictionary.c
index 002a5ac..33d09a9 100644
--- a/e-util/e-spell-dictionary.c
+++ b/e-util/e-spell-dictionary.c
@@ -579,7 +579,7 @@ e_spell_dictionary_get_suggestions (ESpellDictionary *dictionary,
 
 	s = enchant_dict_suggest (dictionary->priv->dict, word, len, &cnt);
 	list = NULL;
-	for (ii = 0; ii < len; ii++) {
+	for (ii = 0; ii < cnt; ii++) {
 		list = g_list_prepend (list, g_strdup (s[ii]));
 	}
 	enchant_dict_free_suggestions (dictionary->priv->dict, s);
diff --git a/widgets/editor/e-editor-spell-check-dialog.c b/widgets/editor/e-editor-spell-check-dialog.c
index 4765f09..bc0a332 100644
--- a/widgets/editor/e-editor-spell-check-dialog.c
+++ b/widgets/editor/e-editor-spell-check-dialog.c
@@ -55,7 +55,7 @@ struct _EEditorSpellCheckDialogPrivate {
 	WebKitDOMDOMSelection *selection;
 
 	gchar *word;
-	EnchantDict *current_dict;
+	ESpellDictionary *current_dict;
 };
 
 static void
@@ -66,8 +66,7 @@ editor_spell_check_dialog_set_word (EEditorSpellCheckDialog *dialog,
 	EEditorWidget *editor_widget;
 	GtkListStore *store;
 	gchar *markup;
-	gchar **suggestions;
-	gint ii;
+	GList *suggestions, *iter;
 
 	if (word == NULL) {
 		return;
@@ -88,17 +87,17 @@ editor_spell_check_dialog_set_word (EEditorSpellCheckDialog *dialog,
 				GTK_TREE_VIEW (dialog->priv->tree_view)));
 	gtk_list_store_clear (store);
 
-	suggestions = enchant_dict_suggest (
-			dialog->priv->current_dict, word, -1, NULL);
-	for (ii = 0; suggestions && suggestions[ii]; ii++) {
-		GtkTreeIter iter;
-		gchar *suggestion = suggestions[ii];
+	suggestions = e_spell_dictionary_get_suggestions (
+			dialog->priv->current_dict, word, -1);
+	for (iter = suggestions; iter; iter = g_list_next (iter)) {
+		GtkTreeIter tree_iter;
+		gchar *suggestion = iter->data;
 
-		gtk_list_store_append (store, &iter);
-		gtk_list_store_set (store, &iter, 0, suggestion, -1);
+		gtk_list_store_append (store, &tree_iter);
+		gtk_list_store_set (store, &tree_iter, 0, suggestion, -1);
 	}
 
-	g_strfreev (suggestions);
+	e_spell_dictionary_free_suggestions (suggestions);
 
 	/* We give focus to WebKit so that the currently selected word
 	 * is highlited. Without focus selection is not visible (at
@@ -358,7 +357,7 @@ editor_spell_check_dialog_ignore (EEditorSpellCheckDialog *dialog)
 		return;
 	}
 
-	enchant_dict_add_to_session (
+	e_spell_dictionary_ignore_word (
 		dialog->priv->current_dict, dialog->priv->word, -1);
 
 	editor_spell_check_dialog_next (dialog);
@@ -371,7 +370,7 @@ editor_spell_check_dialog_learn (EEditorSpellCheckDialog *dialog)
 		return;
 	}
 
-	enchant_dict_add_to_personal (
+	e_spell_dictionary_learn_word (
 		dialog->priv->current_dict, dialog->priv->word, -1);
 
 	editor_spell_check_dialog_next (dialog);
@@ -382,7 +381,7 @@ editor_spell_check_dialog_set_dictionary (EEditorSpellCheckDialog *dialog)
 {
 	GtkTreeModel *model;
 	GtkTreeIter iter;
-	EnchantDict *dictionary;
+	ESpellDictionary *dictionary;
 
 	gtk_combo_box_get_active_iter (
 			GTK_COMBO_BOX (dialog->priv->dictionary_combo), &iter);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]