[Libreoffice-commits] core.git: 2 commits - scaddins/source sw/source

Caolán McNamara caolanm at redhat.com
Mon Feb 16 08:01:17 PST 2015


 scaddins/source/analysis/analysis.cxx |   29 +++++++++--------------------
 scaddins/source/datefunc/datefunc.cxx |   23 +++++++----------------
 scaddins/source/pricing/pricing.cxx   |   25 +++++++------------------
 sw/source/core/bastyp/breakit.cxx     |    1 +
 sw/source/core/txtnode/thints.cxx     |    2 ++
 5 files changed, 26 insertions(+), 54 deletions(-)

New commits:
commit c21b18077d9776c7c36875e0e9c15907cc46f1fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 16 15:47:26 2015 +0000

    include algorithm for std::max
    
    Change-Id: I03c3bf1f920e77871383ab52e2c729154860b15d

diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index bf468b9..559d6f2 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -30,6 +30,7 @@
 #include <unotools/localedatawrapper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
+#include <algorithm>
 
 using namespace com::sun::star;
 
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 343eb64..0f55043 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1257,6 +1257,8 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode )
     OSL_ENSURE( pAttr && pAttr->GetStart() <= Len(), "StartIdx out of bounds!" );
     OSL_ENSURE( !pAttr->GetEnd() || (*pAttr->GetEnd() <= Len()),
             "EndIdx out of bounds!" );
+    if (pAttr->GetEnd() && (*pAttr->GetEnd() > Len()))
+        fprintf(stderr, "debug here\n");
 
     // translate from SetAttrMode to InsertMode (for hints with CH_TXTATR)
     const enum IDocumentContentOperations::InsertFlags nInsertFlags =
commit d929a1715da3088229f6b41b03e9713fe110b881
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 16 14:49:45 2015 +0000

    Related: fdo#74880 small leak in scaddins
    
    Change-Id: I331a3a358c5275b770aa1319f43af21b9bb3fd83

diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx
index f7b7fe8..de02b1c 100644
--- a/scaddins/source/analysis/analysis.cxx
+++ b/scaddins/source/analysis/analysis.cxx
@@ -120,14 +120,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 );
@@ -153,17 +149,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(
@@ -235,8 +225,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 28d9a8d..0aa2d7d 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 305264e..03e7f396 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