[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - scaddins/source
Caolán McNamara
caolanm at redhat.com
Thu Jun 18 05:08:28 PDT 2015
scaddins/source/analysis/analysis.cxx | 29 +++++++++--------------------
scaddins/source/datefunc/datefunc.cxx | 23 +++++++----------------
scaddins/source/pricing/pricing.cxx | 25 +++++++------------------
3 files changed, 23 insertions(+), 54 deletions(-)
New commits:
commit e66fa90393c29c4d5ac3c963ff436c5edc5dedce
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Feb 16 14:49:45 2015 +0000
Related: tdf#91214 crash on exit after loading comment #20
was Related: fdo#74880 small leak in scaddins
(cherry picked from commit d929a1715da3088229f6b41b03e9713fe110b881)
Change-Id: I331a3a358c5275b770aa1319f43af21b9bb3fd83
Reviewed-on: https://gerrit.libreoffice.org/16298
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index ddd5c53..1179673 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -119,14 +119,10 @@ OUString AnalysisAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex
void AnalysisAddIn::InitData( void )
{
- if( pResMgr )
- delete pResMgr;
-
- OString aModName( "analysis" );
- pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) );
+ delete pResMgr;
+ pResMgr = ResMgr::CreateResMgr("analysis", LanguageTag(aFuncLoc));
- if( pFD )
- delete pFD;
+ delete pFD;
if( pResMgr )
pFD = new FuncDataList( *pResMgr );
@@ -152,17 +148,11 @@ AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xC
AnalysisAddIn::~AnalysisAddIn()
{
- if( pFD )
- delete pFD;
-
- if( pFactDoubles )
- delete[] pFactDoubles;
-
- if( pCDL )
- delete pCDL;
-
- if( pDefLocales )
- delete[] pDefLocales;
+ delete pResMgr;
+ delete pCDL;
+ delete[] pFactDoubles;
+ delete pFD;
+ delete[] pDefLocales;
}
sal_Int32 AnalysisAddIn::getDateMode(
@@ -234,8 +224,7 @@ uno::Sequence< OUString > AnalysisAddIn::getSupportedServiceNames_Static()
uno::Reference< uno::XInterface > SAL_CALL AnalysisAddIn_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory >& xServiceFact )
{
- static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new AnalysisAddIn( comphelper::getComponentContext(xServiceFact) );
- return xInst;
+ return (cppu::OWeakObject*) new AnalysisAddIn( comphelper::getComponentContext(xServiceFact) );
}
// XServiceName
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index df62929..4163253 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -166,8 +166,7 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr
uno::Reference< uno::XInterface > SAL_CALL ScaDateAddIn_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory >& )
{
- static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new ScaDateAddIn();
- return xInst;
+ return (cppu::OWeakObject*) new ScaDateAddIn();
}
extern "C" {
@@ -208,12 +207,9 @@ ScaDateAddIn::ScaDateAddIn() :
ScaDateAddIn::~ScaDateAddIn()
{
- if( pFuncDataList )
- delete pFuncDataList;
- if( pDefLocales )
- delete[] pDefLocales;
-
- // pResMgr already deleted (_all_ resource managers are deleted _before_ this dtor is called)
+ delete pFuncDataList;
+ delete pResMgr;
+ delete[] pDefLocales;
}
static const sal_Char* pLang[] = { "de", "en" };
@@ -252,14 +248,9 @@ ResMgr& ScaDateAddIn::GetResMgr() throw( uno::RuntimeException )
void ScaDateAddIn::InitData()
{
- if( pResMgr )
- delete pResMgr;
-
- OString aModName( "date" );
- pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) );
-
- if( pFuncDataList )
- delete pFuncDataList;
+ delete pResMgr;
+ pResMgr = ResMgr::CreateResMgr("date", LanguageTag(aFuncLoc));
+ delete pFuncDataList;
pFuncDataList = pResMgr ? new ScaFuncDataList( *pResMgr ) : NULL;
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx
index 7453fd8..f181d06 100644
--- a/scaddins/source/pricing/pricing.cxx
+++ b/scaddins/source/pricing/pricing.cxx
@@ -171,11 +171,9 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr
uno::Reference< uno::XInterface > SAL_CALL ScaPricingAddIn_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory >& )
{
- static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new ScaPricingAddIn();
- return xInst;
+ return (cppu::OWeakObject*) new ScaPricingAddIn();
}
-
extern "C" {
SAL_DLLPUBLIC_EXPORT void * SAL_CALL pricing_component_getFactory(
@@ -214,12 +212,9 @@ ScaPricingAddIn::ScaPricingAddIn() :
ScaPricingAddIn::~ScaPricingAddIn()
{
- if( pFuncDataList )
- delete pFuncDataList;
- if( pDefLocales )
- delete[] pDefLocales;
-
- // pResMgr already deleted (_all_ resource managers are deleted _before_ this dtor is called)
+ delete pFuncDataList;
+ delete pResMgr;
+ delete[] pDefLocales;
}
static const sal_Char* pLang[] = { "de", "en" };
@@ -258,15 +253,9 @@ ResMgr& ScaPricingAddIn::GetResMgr() throw( uno::RuntimeException )
void ScaPricingAddIn::InitData()
{
-
- if( pResMgr )
- delete pResMgr;
-
- OString aModName( "pricing" );
- pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) );
-
- if( pFuncDataList )
- delete pFuncDataList;
+ delete pResMgr;
+ pResMgr = ResMgr::CreateResMgr("pricing", LanguageTag( aFuncLoc) );
+ delete pFuncDataList;
pFuncDataList = pResMgr ? new ScaFuncDataList( *pResMgr ) : NULL;
More information about the Libreoffice-commits
mailing list