зеркало из https://github.com/mozilla/pjs.git
Bug #305017 --> myspell object gets leaked by mozMySpell
r=mvl sr=bienvenu
This commit is contained in:
Родитель
9000da6291
Коммит
a6d40897e4
|
@ -78,11 +78,13 @@ NS_IMPL_ISUPPORTS1(mozMySpell, mozISpellCheckingEngine)
|
|||
|
||||
mozMySpell::mozMySpell()
|
||||
{
|
||||
mMySpell = NULL;
|
||||
}
|
||||
|
||||
mozMySpell::~mozMySpell()
|
||||
{
|
||||
mPersonalDictionary = nsnull;
|
||||
delete mMySpell;
|
||||
}
|
||||
|
||||
/* attribute wstring dictionary; */
|
||||
|
@ -134,6 +136,11 @@ NS_IMETHODIMP mozMySpell::SetDictionary(const PRUnichar *aDictionary)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
file->GetPath(dictFileName);
|
||||
|
||||
// SetDictionary can be called multiple times, so we might have a valid mMySpell instance
|
||||
// which needs cleaned up.
|
||||
if (mMySpell)
|
||||
delete mMySpell;
|
||||
|
||||
mMySpell = new MySpell(NS_ConvertUTF16toUTF8(affFileName).get(), NS_ConvertUTF16toUTF8(dictFileName).get());
|
||||
if (!mMySpell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -35,15 +35,13 @@ MySpell::MySpell(const char * affpath, const char * dpath)
|
|||
|
||||
MySpell::~MySpell()
|
||||
{
|
||||
if (pSMgr) delete pSMgr;
|
||||
if (pAMgr) delete pAMgr;
|
||||
if (pHMgr) delete pHMgr;
|
||||
pSMgr = NULL;
|
||||
pAMgr = NULL;
|
||||
pHMgr = NULL;
|
||||
delete pSMgr;
|
||||
delete pAMgr;
|
||||
delete pHMgr;
|
||||
|
||||
csconv= NULL;
|
||||
if (encoding) free(encoding);
|
||||
encoding = NULL;
|
||||
if (encoding)
|
||||
free(encoding);
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче