summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@gmail.com>2012-07-22 15:29:05 +0200
committerArnaud Versini <arnaud.versini@gmail.com>2012-07-22 15:32:37 +0200
commit51065497ea83e90764860784dc6e193faaf0d673 (patch)
tree68b88a653d62940021983410ca82e911082a273a /lingucomponent
parent92b016c45a61d0aaff619e71e3ce31ce04f573bf (diff)
Cleanup memory managment and constructor in SpellChecker
Change-Id: I086596bc54cada121f5eaaf8f4c0f12e836b3ac9
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx33
1 files changed, 15 insertions, 18 deletions
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index b8f65536e2a7..39d67d22fe0f 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -73,16 +73,16 @@ using ::rtl::OString;
///////////////////////////////////////////////////////////////////////////
-SpellChecker::SpellChecker()
- : aEvtListeners(GetLinguMutex())
+SpellChecker::SpellChecker() :
+ aDicts(NULL),
+ aDEncs(NULL),
+ aDLocs(NULL),
+ aDNames(NULL),
+ numdict(0),
+ aEvtListeners(GetLinguMutex()),
+ pPropHelper(NULL),
+ bDisposing(sal_False)
{
- aDicts = NULL;
- aDEncs = NULL;
- aDLocs = NULL;
- aDNames = NULL;
- bDisposing = sal_False;
- pPropHelper = NULL;
- numdict = 0;
}
SpellChecker::~SpellChecker()
@@ -92,18 +92,12 @@ SpellChecker::~SpellChecker()
for (int i = 0; i < numdict; ++i)
{
delete aDicts[i];
- aDicts[i] = NULL;
}
delete[] aDicts;
}
- aDicts = NULL;
- numdict = 0;
delete[] aDEncs;
- aDEncs = NULL;
delete[] aDLocs;
- aDLocs = NULL;
delete[] aDNames;
- aDNames = NULL;
if (pPropHelper)
{
pPropHelper->RemoveAsPropListener();
@@ -162,8 +156,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
// is not yet supported by the list od new style dictionaries
MergeNewStyleDicsAndOldStyleDics( aDics, aOldStyleDics );
- numdict = aDics.size();
- if (numdict)
+ if (!aDics.empty())
{
// get supported locales from the dictionaries-to-use...
sal_Int32 k = 0;
@@ -239,9 +232,13 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
{
/* no dictionary found so register no dictionaries */
numdict = 0;
+ delete[] aDicts;
aDicts = NULL;
- aDEncs = NULL;
+ delete[] aDEncs;
+ aDEncs = NULL;
+ delete[] aDLocs;
aDLocs = NULL;
+ delete[] aDNames;
aDNames = NULL;
aSuppLocales.realloc(0);
}