[Libreoffice-commits] .: lingucomponent/source

Arnaud Versini aversini at kemper.freedesktop.org
Sun Jul 22 06:36:35 PDT 2012


 lingucomponent/source/spellcheck/spell/sspellimp.cxx |   33 ++++++++-----------
 1 file changed, 15 insertions(+), 18 deletions(-)

New commits:
commit 51065497ea83e90764860784dc6e193faaf0d673
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Sun Jul 22 15:29:05 2012 +0200

    Cleanup memory managment and constructor in SpellChecker
    
    Change-Id: I086596bc54cada121f5eaaf8f4c0f12e836b3ac9

diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index b8f6553..39d67d2 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);
         }


More information about the Libreoffice-commits mailing list