[evolution-patches] [gnome spell] #67804 Adding word to dictionary caused Evo to crash




Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-spell/gnome-spell/ChangeLog,v
retrieving revision 1.41
diff -u -p -r1.41 ChangeLog
--- ChangeLog	29 Mar 2004 15:47:51 -0000	1.41
+++ ChangeLog	12 Oct 2004 17:28:57 -0000
@@ -1,3 +1,9 @@
+2004-10-12  Radek Doulik  <rodo ximian com>
+
+	* dictionary.c (impl_gnome_spell_dictionary_add_word_to_personal):
+	return if language is null
+	add tests duplicating g_return_* glib macros
+
 2004-02-27    <rodo ximian com>
 
 	* dictionary.c: added Turkish
Index: dictionary.c
===================================================================
RCS file: /cvs/gnome/gnome-spell/gnome-spell/dictionary.c,v
retrieving revision 1.37
diff -u -p -r1.37 dictionary.c
--- dictionary.c	27 Feb 2004 11:04:03 -0000	1.37
+++ dictionary.c	12 Oct 2004 17:28:58 -0000
@@ -317,7 +317,12 @@ impl_gnome_spell_dictionary_set_language
 	gchar *one_language;
 	gint len;
 
-	g_assert (dict);
+#ifndef G_DISABLE_CHECKS
+	g_return_if_fail (dict);
+#else
+	if (!dict)
+		return;
+#endif
 	if (!language)
 		language = "";
 
@@ -374,7 +379,7 @@ update_engine (SpellEngine *se, CORBA_En
 static void
 update_engines (GNOMESpellDictionary *dict, CORBA_Environment * ev)
 {
-	g_assert (IS_GNOME_SPELL_DICTIONARY (dict));
+	g_return_if_fail (IS_GNOME_SPELL_DICTIONARY (dict));
 
 	if (dict->changed) {
 		GSList *l;
@@ -393,8 +398,12 @@ engine_check_word (SpellEngine *se, cons
 	CORBA_boolean result = CORBA_TRUE;
 	gint aspell_result;
 
+#ifndef G_DISABLE_CHECKS
 	g_return_val_if_fail (se->speller, CORBA_TRUE);
-
+#else
+	if (!se->speller)
+		return CORBA_TRUE;
+#endif
 	aspell_result = aspell_speller_check (se->speller, word, strlen (word));
 	if (aspell_result == 0)
 		result = CORBA_FALSE;
@@ -414,8 +423,12 @@ impl_gnome_spell_dictionary_check_word (
 	GSList *l;
 	gboolean valid_speller = FALSE;
 
+#ifndef G_DISABLE_CHECKS
 	g_return_val_if_fail (word, result);
-
+#else
+	if (!word)
+		return result;
+#endif
 	if (!strcmp (word, "Ximian"))
 		return CORBA_TRUE;
 
@@ -442,8 +455,12 @@ impl_gnome_spell_dictionary_add_word_to_
 	GNOMESpellDictionary *dict = GNOME_SPELL_DICTIONARY (bonobo_object_from_servant (servant));
 	GSList *l;
 
+#ifndef G_DISABLE_CHECKS
 	g_return_if_fail (word);
-
+#else
+	if (!word)
+		return;
+#endif
 	update_engines (dict, ev);
 	DICT_DEBUG (printf ("Dictionary add_word_to_session: %s\n", word));
 	for (l = dict->engines; l; l = l->next) {
@@ -459,8 +476,12 @@ impl_gnome_spell_dictionary_add_word_to_
 	GNOMESpellDictionary *dict = GNOME_SPELL_DICTIONARY (bonobo_object_from_servant (servant));
 	SpellEngine *se;
 
-	g_return_if_fail (word);
-
+#ifndef G_DISABLE_CHECKS
+	g_return_if_fail (word && language);
+#else
+	if (!word || !language)
+		return;
+#endif
 	update_engines (dict, ev);
 	DICT_DEBUG (printf ("Dictionary add_word_to_personal: %s (%s)\n", word, language));
 	se = (SpellEngine *) g_hash_table_lookup (dict->languages, language);
@@ -479,9 +500,12 @@ impl_gnome_spell_dictionary_set_correcti
 	GNOMESpellDictionary *dict = GNOME_SPELL_DICTIONARY (bonobo_object_from_servant (servant));
 	SpellEngine *se;
 
-	g_return_if_fail (word);
-	g_return_if_fail (replacement);
-
+#ifndef G_DISABLE_CHECKS
+	g_return_if_fail (word && replacement);
+#else
+	if (!word || !replacement)
+		return;
+#endif
 	update_engines (dict, ev);
 	DICT_DEBUG (printf ("Dictionary correction: %s <-- %s\n", word, replacement));
 	se = (SpellEngine *) g_hash_table_lookup (dict->languages, language);
@@ -505,8 +529,12 @@ impl_gnome_spell_dictionary_get_suggesti
 	GSList *l, *suggestion_list = NULL;
 	gint i, len, pos;
 
+#ifndef G_DISABLE_CHECKS
 	g_return_val_if_fail (word, NULL);
-
+#else
+	if (!word)
+		return NULL;
+#endif
 	DICT_DEBUG (printf ("Dictionary correction: %s\n", word));
 	update_engines (dict, ev);
 


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