diff -r df43695d5c88 linguistic/source/lngsvcmgr.cxx --- a/linguistic/source/lngsvcmgr.cxx Wed Jun 30 20:59:38 2010 +0100 +++ b/linguistic/source/lngsvcmgr.cxx Fri Jul 02 20:08:49 2010 +0100 @@ -45,6 +45,8 @@ #include #include +#include + #include "lngsvcmgr.hxx" #include "lngopt.hxx" #include "misc.hxx" @@ -605,6 +607,14 @@ EnableNotification( aNames ); } +void LngSvcMgr::clearSvcInfoArray(SvcInfoArray* pInfo) +{ + if (pInfo) + { + std::for_each(pInfo->begin(), pInfo->end(), boost::checked_deleter()); + delete pInfo; + } +} LngSvcMgr::~LngSvcMgr() { @@ -612,10 +622,10 @@ // will be freed in the destructor of the respective Reference's // xSpellDsp, xGrammarDsp, xHyphDsp, xThesDsp - delete pAvailSpellSvcs; - delete pAvailGrammarSvcs; - delete pAvailHyphSvcs; - delete pAvailThesSvcs; + clearSvcInfoArray(pAvailSpellSvcs); + clearSvcInfoArray(pAvailGrammarSvcs); + clearSvcInfoArray(pAvailHyphSvcs); + clearSvcInfoArray(pAvailThesSvcs); } @@ -652,7 +662,7 @@ if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailSpellSvcs; pAvailSpellSvcs = 0; + clearSvcInfoArray(pAvailSpellSvcs); pAvailSpellSvcs = 0; OUString aNode( aSpellCheckerList ); if (lcl_SeqHasString( aSpellCheckerListEntries, aKeyText )) @@ -677,7 +687,7 @@ else if (0 == rName.compareTo( aGrammarCheckerList, aGrammarCheckerList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0; + clearSvcInfoArray(pAvailGrammarSvcs); pAvailGrammarSvcs = 0; OUString aNode( aGrammarCheckerList ); if (lcl_SeqHasString( aGrammarCheckerListEntries, aKeyText )) @@ -705,7 +715,7 @@ else if (0 == rName.compareTo( aHyphenatorList, aHyphenatorList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailHyphSvcs; pAvailHyphSvcs = 0; + clearSvcInfoArray(pAvailHyphSvcs); pAvailHyphSvcs = 0; OUString aNode( aHyphenatorList ); if (lcl_SeqHasString( aHyphenatorListEntries, aKeyText )) @@ -730,7 +740,7 @@ else if (0 == rName.compareTo( aThesaurusList, aThesaurusList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailThesSvcs; pAvailThesSvcs = 0; + clearSvcInfoArray(pAvailThesSvcs); pAvailThesSvcs = 0; OUString aNode( aThesaurusList ); if (lcl_SeqHasString( aThesaurusListEntries, aKeyText )) @@ -1402,7 +1412,7 @@ { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailSpellSvcs; pAvailSpellSvcs = 0; + clearSvcInfoArray(pAvailSpellSvcs); pAvailSpellSvcs = 0; GetAvailableSpellSvcs_Impl(); pInfoArray = pAvailSpellSvcs; } @@ -1410,7 +1420,7 @@ { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0; + clearSvcInfoArray(pAvailGrammarSvcs); pAvailGrammarSvcs = 0; GetAvailableGrammarSvcs_Impl(); pInfoArray = pAvailGrammarSvcs; } @@ -1418,7 +1428,7 @@ { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailHyphSvcs; pAvailHyphSvcs = 0; + clearSvcInfoArray(pAvailHyphSvcs); pAvailHyphSvcs = 0; GetAvailableHyphSvcs_Impl(); pInfoArray = pAvailHyphSvcs; } @@ -1426,7 +1436,7 @@ { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailThesSvcs; pAvailThesSvcs = 0; + clearSvcInfoArray(pAvailThesSvcs); pAvailThesSvcs = 0; GetAvailableThesSvcs_Impl(); pInfoArray = pAvailThesSvcs; } diff -r df43695d5c88 linguistic/source/lngsvcmgr.hxx --- a/linguistic/source/lngsvcmgr.hxx Wed Jun 30 20:59:38 2010 +0100 +++ b/linguistic/source/lngsvcmgr.hxx Fri Jul 02 20:08:49 2010 +0100 @@ -143,6 +143,8 @@ void SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, const SvcInfoArray &rAvailSvcs ); + static void clearSvcInfoArray(SvcInfoArray *pInfo); + // utl::ConfigItem (to allow for listening of changes of relevant properties) virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); virtual void Commit();