Add destructor to CMYSpellLand & CMSSpellLand

This commit is contained in:
Stas Degteff 2006-11-23 14:30:25 +00:00
parent 4c06ab12ea
commit 9ff0025e52
2 changed files with 7 additions and 0 deletions

View File

@ -231,6 +231,7 @@ bool CMSSpellLang::Load(const char *codeset, const char *userdic)
{ {
bool result = false; bool result = false;
if( mLibrary != NULL ) return true; // Already loaded
mLibrary = LoadLibrary(mEngine); mLibrary = LoadLibrary(mEngine);
CHECK_NULL(mLibrary, cleanup0); CHECK_NULL(mLibrary, cleanup0);
@ -474,6 +475,8 @@ bool CMYSpellLang::Init(const gdirentry *entry)
bool CMYSpellLang::Load(const char *codeset, const char *) bool CMYSpellLang::Load(const char *codeset, const char *)
{ {
if (mMSpell) return mIsMdrLoaded;
mMSpell = new Hunspell(mEngine, mDictionary); mMSpell = new Hunspell(mEngine, mDictionary);
if (mMSpell) if (mMSpell)
@ -493,6 +496,7 @@ void CMYSpellLang::UnLoad()
if (!mMSpell) return; if (!mMSpell) return;
delete mMSpell; delete mMSpell;
mMSpell = NULL; mMSpell = NULL;
mIsMdrLoaded = false;
if (mToDicTable) delete mToDicTable; if (mToDicTable) delete mToDicTable;
if (mToLocTable) delete mToLocTable; if (mToLocTable) delete mToLocTable;
mToDicTable = mToLocTable = NULL; mToDicTable = mToLocTable = NULL;

View File

@ -74,6 +74,7 @@ public:
mIsMdrLoaded = mIsUdrLoaded = false; mIsMdrLoaded = mIsUdrLoaded = false;
mToDicTable = mToLocTable = NULL; mToDicTable = mToLocTable = NULL;
} }
virtual ~CSpellLang() = 0;
virtual bool Load(const char *codeset, const char *userdic) = 0; virtual bool Load(const char *codeset, const char *userdic) = 0;
virtual void UnLoad() = 0; virtual void UnLoad() = 0;
@ -217,6 +218,7 @@ public:
mLibrary = NULL; mLibrary = NULL;
mSpellType = SCHECKET_TYPE_MSSPELL; mSpellType = SCHECKET_TYPE_MSSPELL;
} }
virtual ~CMSSpellLang(){ UnLoad(); }
bool Init(HKEY hKey, const char *name); bool Init(HKEY hKey, const char *name);
@ -252,6 +254,7 @@ public:
mMSpell = NULL; mMSpell = NULL;
mSpellType = SCHECKET_TYPE_MYSPELL; mSpellType = SCHECKET_TYPE_MYSPELL;
} }
virtual ~CMYSpellLang(){ UnLoad(); }
bool Init(const gdirentry *entry); bool Init(const gdirentry *entry);