summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <domlachowicz@gmail.com>2003-08-26 13:20:40 +0000
committerDom Lachowicz <domlachowicz@gmail.com>2003-08-26 13:20:40 +0000
commit3b5f8d0fae24b5377d9fb849cd01925cf4c23f08 (patch)
tree75cbbe838a324f1d4bb99d1c3cecea4613bf0df5
parent2a2e356997be21b5c8a5e06a7f9ac5229512d06e (diff)
downloadenchant-3b5f8d0fae24b5377d9fb849cd01925cf4c23f08.tar.gz
ispell crasher fix, implement enchant_dictionary_release
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@20821 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--src/enchant.c20
-rw-r--r--src/ispell/ispell_checker.cpp11
-rw-r--r--src/ispell/ispell_checker.h2
-rw-r--r--src/ispell/lookup.cpp4
4 files changed, 24 insertions, 13 deletions
diff --git a/src/enchant.c b/src/enchant.c
index d76422a..99e2acd 100644
--- a/src/enchant.c
+++ b/src/enchant.c
@@ -721,9 +721,16 @@ enchant_broker_init (void)
ENCHANT_MODULE_EXPORT (void)
enchant_broker_term (EnchantBroker * broker)
{
- g_return_if_fail (broker);
-
- /* will destroy the dictionaries for us */
+ guint n_remaining;
+
+ g_return_if_fail (broker);
+
+ n_remaining = g_hash_table_size (broker->dict_map);
+ if (n_remaining) {
+ g_warning ("%u dictionaries weren't free'd.\n", n_remaining);
+ }
+
+ /* will destroy any remaining dictionaries for us */
g_hash_table_destroy (broker->dict_map);
g_hash_table_destroy (broker->provider_ordering);
@@ -864,11 +871,14 @@ enchant_dict_describe (EnchantDict * dict,
ENCHANT_MODULE_EXPORT (void)
enchant_broker_release_dict (EnchantBroker * broker, EnchantDict * dict)
{
+ EnchantSession * session;
+
g_return_if_fail (broker);
g_return_if_fail (dict);
+
+ session = (EnchantSession*)dict->enchant_private_data;
- /* we currently don't really release the dictionary until
- the broker is shutdown due to possible race conditions */
+ g_hash_table_remove (broker->dict_map, session->language_tag);
}
/**
diff --git a/src/ispell/ispell_checker.cpp b/src/ispell/ispell_checker.cpp
index 22db79a..23500d6 100644
--- a/src/ispell/ispell_checker.cpp
+++ b/src/ispell/ispell_checker.cpp
@@ -207,11 +207,12 @@ ISpellChecker::ISpellChecker()
ISpellChecker::~ISpellChecker()
{
- if (m_initialized)
- lcleanup(); // only cleanup our mess if we were successfully initialized
-
- clearindex (m_pflagindex);
- clearindex (m_sflagindex);
+ if (m_bSuccessfulInit) {
+ // only cleanup our mess if we were successfully initialized
+
+ clearindex (m_pflagindex);
+ clearindex (m_sflagindex);
+ }
FREEP(m_hashtbl);
FREEP(m_hashstrings);
diff --git a/src/ispell/ispell_checker.h b/src/ispell/ispell_checker.h
index e2be8a0..8ef68a1 100644
--- a/src/ispell/ispell_checker.h
+++ b/src/ispell/ispell_checker.h
@@ -263,8 +263,6 @@ private:
GIConv m_translate_in; /* Selected translation from/to Unicode */
GIConv m_translate_out;
-
- bool m_initialized;
};
#endif /* ISPELL_CHECKER_H */
diff --git a/src/ispell/lookup.cpp b/src/ispell/lookup.cpp
index 326d608..2068ea7 100644
--- a/src/ispell/lookup.cpp
+++ b/src/ispell/lookup.cpp
@@ -72,6 +72,9 @@
/*
* $Log$
+ * Revision 1.6 2003/08/26 13:20:40 dom
+ * ispell crasher fix, implement enchant_dictionary_release
+ *
* Revision 1.5 2003/08/26 13:08:03 uwog
* Fix segfault when the requested dictionary couldn't be found.
*
@@ -555,7 +558,6 @@ int ISpellChecker::linit (char *hashname)
}
initckch(NULL);
- m_initialized = true;
return (0);
}