[Libreoffice-commits] core.git: 4 commits - jvmfwk/source leak-suppress.txt oox/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Aug 25 04:16:21 PDT 2014


 jvmfwk/source/elements.cxx                       |    3 --
 leak-suppress.txt                                |    3 ++
 oox/source/drawingml/chart/modelbase.cxx         |    2 -
 oox/source/drawingml/effectproperties.cxx        |   16 +++++++--------
 oox/source/drawingml/effectproperties.hxx        |    4 ++-
 oox/source/drawingml/effectpropertiescontext.cxx |   24 +++++++++++------------
 oox/source/drawingml/shape.cxx                   |    6 ++---
 7 files changed, 30 insertions(+), 28 deletions(-)

New commits:
commit 6797610bcfc41d2af57db03c5d9b52cfc30d09ed
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 13:00:41 2014 +0200

    use ptr_vector to prevent memory leak
    
    Found by Lsan.
    
    Change-Id: I727098ea3861bacf89209615e4b46e986a72c1ce

diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx
index da94669..2fa608a 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -35,16 +35,16 @@ void EffectProperties::assignUsed( const EffectProperties& rSourceProps )
 void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
         const GraphicHelper& rGraphicHelper ) const
 {
-    for( std::vector< Effect* >::const_iterator it = maEffects.begin(); it != maEffects.end(); ++it )
-        if( (*it)->msName == "outerShdw" )
+    for( boost::ptr_vector< Effect >::const_iterator it = maEffects.begin(); it != maEffects.end(); ++it )
+        if( it->msName == "outerShdw" )
         {
             sal_Int32 nAttrDir = 0, nAttrDist = 0;
-            std::map< OUString, css::uno::Any >::iterator attribIt = (*it)->maAttribs.find( "dir" );
-            if( attribIt != (*it)->maAttribs.end() )
+            std::map< OUString, css::uno::Any >::const_iterator attribIt = it->maAttribs.find( "dir" );
+            if( attribIt != it->maAttribs.end() )
                 attribIt->second >>= nAttrDir;
 
-            attribIt = (*it)->maAttribs.find( "dist" );
-            if( attribIt != (*it)->maAttribs.end() )
+            attribIt = it->maAttribs.find( "dist" );
+            if( attribIt != it->maAttribs.end() )
                 attribIt->second >>= nAttrDist;
 
             // Negative X or Y dist indicates left or up, respectively
@@ -56,8 +56,8 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
             rPropMap.setProperty( PROP_Shadow, true );
             rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
             rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
-            rPropMap.setProperty( PROP_ShadowColor, (*it)->moColor.getColor(rGraphicHelper, -1 ) );
-            rPropMap.setProperty( PROP_ShadowTransparence, (*it)->moColor.getTransparency());
+            rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper, -1 ) );
+            rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency());
         }
 }
 
diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx
index dae858c..4256b8d 100644
--- a/oox/source/drawingml/effectproperties.hxx
+++ b/oox/source/drawingml/effectproperties.hxx
@@ -14,6 +14,8 @@
 #include <oox/drawingml/color.hxx>
 #include <oox/helper/propertymap.hxx>
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 namespace oox {
 namespace drawingml {
 
@@ -42,7 +44,7 @@ struct EffectProperties
     EffectShadowProperties maShadow;
 
     /** Stores all effect properties, including those not supported by core yet */
-    std::vector< Effect* > maEffects;
+    boost::ptr_vector< Effect > maEffects;
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const EffectProperties& rSourceProps );
diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index c99d364..7d6549c 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -76,22 +76,22 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
     {
         case A_TOKEN( outerShdw ):
         {
-            mrEffectProperties.maEffects[nPos]->msName = "outerShdw";
-            saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
+            mrEffectProperties.maEffects[nPos].msName = "outerShdw";
+            saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs );
 
             mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 );
             mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 );
-            return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
+            return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor );
         }
         break;
         case A_TOKEN( innerShdw ):
         {
-            mrEffectProperties.maEffects[nPos]->msName = "innerShdw";
-            saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
+            mrEffectProperties.maEffects[nPos].msName = "innerShdw";
+            saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs );
 
             mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 );
             mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 );
-            return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
+            return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor );
         }
         break;
         case A_TOKEN( glow ):
@@ -100,15 +100,15 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
         case A_TOKEN( blur ):
         {
             if( nElement == A_TOKEN( glow ) )
-                mrEffectProperties.maEffects[nPos]->msName = "glow";
+                mrEffectProperties.maEffects[nPos].msName = "glow";
             else if( nElement == A_TOKEN( softEdge ) )
-                mrEffectProperties.maEffects[nPos]->msName = "softEdge";
+                mrEffectProperties.maEffects[nPos].msName = "softEdge";
             else if( nElement == A_TOKEN( reflection ) )
-                mrEffectProperties.maEffects[nPos]->msName = "reflection";
+                mrEffectProperties.maEffects[nPos].msName = "reflection";
             else if( nElement == A_TOKEN( blur ) )
-                mrEffectProperties.maEffects[nPos]->msName = "blur";
-            saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
-            return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
+                mrEffectProperties.maEffects[nPos].msName = "blur";
+            saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs );
+            return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor );
         }
         break;
     }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index af4acd1..8545307 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -919,16 +919,16 @@ Reference< XShape > Shape::createAndInsert(
             {
                 Sequence< PropertyValue > aEffects( aEffectProperties.maEffects.size() );
                 sal_uInt32 i = 0;
-                for( std::vector< Effect* >::iterator it = aEffectProperties.maEffects.begin();
+                for( boost::ptr_vector< Effect >::iterator it = aEffectProperties.maEffects.begin();
                         it != aEffectProperties.maEffects.end(); ++it )
                 {
-                    PropertyValue aEffect = (*it)->getEffect();
+                    PropertyValue aEffect = it->getEffect();
                     if( !aEffect.Name.isEmpty() )
                     {
                         Sequence< PropertyValue > aEffectsGrabBag( 3 );
                         PUT_PROP( aEffectsGrabBag, 0, "Attribs", aEffect.Value );
 
-                        Color& aColor( (*it)->moColor );
+                        Color& aColor( it->moColor );
                         OUString sColorScheme = aColor.getSchemeName();
                         if( sColorScheme.isEmpty() )
                         {
commit 0e061bd9a6d6c464bb63043d99257a36dc740496
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 12:12:45 2014 +0200

    we leak the RTTI information knowingly
    
    Most likely show up since 9c9f0ea2c38929d133b0fe2faf616ecab17e07c9
    
    Change-Id: I9d097c1098edc626db67171893411363e13d7941

diff --git a/leak-suppress.txt b/leak-suppress.txt
index 096027e..5c04b7c 100644
--- a/leak-suppress.txt
+++ b/leak-suppress.txt
@@ -22,3 +22,6 @@ leak:soltools/cpp/_cpp.c
 
 # resource managers, normally global objects
 leak:ResMgr::CreateResMgr
+
+# bridge's RTTI information, leaked knowingly
+leak:RTTI::getRTTI
commit c76b5ace20a29dc16f1f71ccd8e5d6e73b9ce9fd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 12:00:19 2014 +0200

    this code is redundant and leaks memory
    
    Change-Id: Ib57f44c203ead68102d712ef29ab7362b0cea8db

diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 55cdfa7..a1c5aa9 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -744,9 +744,6 @@ bool NodeJava::createSettingsDocument() const
     CXmlDocPtr doc(xmlNewDoc((xmlChar *)"1.0"));
     if (! doc)
         throw FrameworkException(JFW_E_ERROR, sExcMsg);
-    //Create a comment
-    xmlNewDocComment(
-        doc, (xmlChar *) "This is a generated file. Do not alter this file!");
 
     //Create the root element and name spaces
     xmlNodePtr root =   xmlNewDocNode(
commit 5d05367268a512a069670e70e4d896370513a24b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Aug 25 12:23:38 2014 +0200

    import the sourceLinked attribute
    
    Change-Id: I74cdf7a09b2e6e3b3cd8f07b5d3495dcc66848c5

diff --git a/oox/source/drawingml/chart/modelbase.cxx b/oox/source/drawingml/chart/modelbase.cxx
index 27cb179..519f74d 100644
--- a/oox/source/drawingml/chart/modelbase.cxx
+++ b/oox/source/drawingml/chart/modelbase.cxx
@@ -32,8 +32,8 @@ NumberFormat::NumberFormat() :
 
 void NumberFormat::setAttributes( const AttributeList& rAttribs )
 {
+    mbSourceLinked = rAttribs.getBool( XML_sourceLinked, true);
     maFormatCode = rAttribs.getString( XML_formatCode, OUString() );
-    // TODO: if XML_sourceLinked is true, <c:formatCode> should be used instead.
 }
 
 LayoutModel::LayoutModel() :


More information about the Libreoffice-commits mailing list