aspell-devel
[Top][All Lists]
Advanced

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

[pspell] Fix for A. Dufour's problem.


From: torrevandamme
Subject: [pspell] Fix for A. Dufour's problem.
Date: Mon, 13 Nov 2000 06:47:46 -0500

Hi,

I've modified Alain's program and it seems that the core dumps do not appear 
anymore.

In the method SetLanguage you delete the manager to soon.
Here's your code with my modification:

bool MySpell::SetLanguage(char const *lang) {
                       bool status = false;
                       strcpy(language, lang);
                       delete_pspell_config(config);
               // Modification!!!
               // Don't delete your manager here!!!!
                       //delete_pspell_manager(manager);
               // End of modification...
                       config = new_pspell_config();
                       config->replace("language-tag", language);
                       ret = new_pspell_manager(config);
                       if (ret->error_number() != 0) {
                               // Handle error...
                               cout << ret->error_message() << endl;
                               delete_pspell_can_have_error(ret);
                               status = false;
                       } else {
                   // Modification!!!!
                   // Delete the old manager here!!!
                   delete_pspell_manager(manager);
                   // End of modification.
                               manager = (PspellManager *) ret;
                               (*vManager)[activeDocument] = manager;
                               PrintConfigDetails();
                               status = true;
                       }
                       return(status);
               }

The same goes for the method SetSpellCheckMode(). 
The problem you had was that you delete the active manager before you were 
sure that you've successfully created a new manager. 
Still this solution doesn't make sense with the problems switching between to 
i-spell languages. It doesn't recognise the language, which is strange. Maybe 
someone else has an idea what is going on.

Thanks Alain for the code. It is real interesting code and I think serves as 
a good starting point for any C++ spellcheck implementation. I don't have a 
lot of knowledge of STL containers, but wouldn't a deque container be more 
appropriate to store the managers in case you want to delete any of the 
mangagers.

Bye

T. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]