Attempt to fix collateral action of function LoadCharset() which called from schecker.Load(). Bugreport from Vladimir Fyodorov 2:50/15@fidonet

This commit is contained in:
Stas Degteff
2012-05-15 17:02:39 +00:00
parent c21c518165
commit 4b33543f42
3 changed files with 29 additions and 1 deletions

View File

@@ -2851,6 +2851,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
#if defined(GCFG_SPELL_INCLUDED)
if (CFG->scheckerenabled)
{
int save_chartableno = LoadCharset(NULL,NULL,1); // Workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
schecker.Init(CFG->xlatlocalset, CFG->scheckerdicpath);
char *str = strdup(AA->adat->scheckerdeflang);
char *token = strtok(str, " ");
@@ -2861,6 +2862,11 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
token = strtok(NULL, " ");
}
free(str);
if(save_chartableno != -1) // restore value of the default chaset table // workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
}
#endif

View File

@@ -1242,7 +1242,12 @@ int GMenuSChecker::Run(CSpellChecker &schecker, const char *word)
{
if (!schecker.IsLoaded(langs[finaltag-TAG_LANG-1]->GetLangCode()))
{
int save_chartableno = LoadCharset(NULL,NULL,1); // Workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
schecker.Load(langs[finaltag-TAG_LANG-1]->GetLangCode(), CFG->scheckeruserdic);
if(save_chartableno != -1) // restore value of the default chaset table // workaround: internal for LoadCharset() charset table number changed in the schecker.Load()
LoadCharset(CFG->xlatcharset[save_chartableno].imp, CFG->xlatcharset[save_chartableno].exp);
else
LoadCharset("N/A","N/A");
}
else
{