[Libreoffice-commits] core.git: 4 commits - embeddedobj/source filter/source include/filter sd/source vcl/source

Stephan Bergmann sbergman at redhat.com
Tue Jan 12 23:05:13 PST 2016


 embeddedobj/source/general/dummyobject.cxx |    8 +++-----
 embeddedobj/source/inc/dummyobject.hxx     |   11 ++++++++---
 filter/source/msfilter/svdfppt.cxx         |    9 +++++----
 include/filter/msfilter/svdfppt.hxx        |    6 ++----
 sd/source/filter/sdpptwrp.cxx              |    2 ++
 vcl/source/outdev/font.cxx                 |    1 +
 6 files changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 14c42d4b3c60cb2a95cb73c9b20e51a29e5f9810
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 12 16:53:50 2016 +0100

    Fix memory leak
    
    Change-Id: I346a88a802ed5b1f373cd10cff794f93cf6d909a

diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ef3929d..923347c 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -926,6 +926,7 @@ vcl::Font OutputDevice::GetDefaultFont( DefaultFontType nType, LanguageType eLan
                             aFont.SetName( pFontInstance->maFontSelData.mpFontData->GetFamilyName() );
                         else
                             aFont.SetName( pFontInstance->maFontSelData.maTargetName );
+                        pOutDev->mpFontCache->Release(pFontInstance);
                     }
                 }
             }
commit 13ca560d136e833efabef843c57771c96d865964
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 12 16:53:38 2016 +0100

    Fix memory leak
    
    Change-Id: I82ce013a42ac1cd9bb4f3842e9fba8fbc6056b3c

diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx
index caaf388..9af31b6 100644
--- a/embeddedobj/source/general/dummyobject.cxx
+++ b/embeddedobj/source/general/dummyobject.cxx
@@ -30,8 +30,6 @@
 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 
-#include <cppuhelper/interfacecontainer.h>
-
 #include <dummyobject.hxx>
 
 
@@ -594,7 +592,7 @@ void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference
         return;
 
     if ( !m_pInterfaceContainer )
-        m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
+        m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ));
 
     m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(),
                                                         xListener );
@@ -676,7 +674,7 @@ void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util
         return;
 
     if ( !m_pInterfaceContainer )
-        m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
+        m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ));
 
     m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener );
 }
@@ -700,7 +698,7 @@ void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< docu
         return;
 
     if ( !m_pInterfaceContainer )
-        m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
+        m_pInterfaceContainer.reset(new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ));
 
     m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener );
 }
diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx
index 1a0739c..2587bcc 100644
--- a/embeddedobj/source/inc/dummyobject.hxx
+++ b/embeddedobj/source/inc/dummyobject.hxx
@@ -20,12 +20,17 @@
 #ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
 #define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
 
+#include <sal/config.h>
+
+#include <memory>
+
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 #include <com/sun/star/embed/XEmbedPersist.hpp>
 #include <cppuhelper/implbase.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
 
 namespace com { namespace sun { namespace star {
     namespace embed {
@@ -49,7 +54,8 @@ class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
                         , css::embed::XEmbedPersist >
 {
     ::osl::Mutex    m_aMutex;
-    ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
+    std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper>
+        m_pInterfaceContainer;
     bool m_bDisposed;
 
     OUString m_aEntryName;
@@ -75,8 +81,7 @@ protected:
 public:
 
     ODummyEmbeddedObject()
-    : m_pInterfaceContainer( nullptr )
-    , m_bDisposed( false )
+    : m_bDisposed( false )
     , m_nObjectState( -1 )
     , m_nCachedAspect( 0 )
     , m_bHasCachedSize( false )
commit 55a754cca0f299b658d99684caa9e15cbdd90cc6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 12 10:15:57 2016 +0100

    Fix memory leak
    
    Change-Id: Icf46bc3c086a8221e08a4bb18e1f64355043cdbb

diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx
index 02b9e39..f5318b0 100644
--- a/sd/source/filter/sdpptwrp.cxx
+++ b/sd/source/filter/sdpptwrp.cxx
@@ -109,6 +109,8 @@ bool SdPPTFilter::Import()
 
                     if ( !bRet )
                         mrMedium.SetError( SVSTREAM_WRONGVERSION, OSL_LOG_PREFIX );
+                    pLibrary->release(); //TODO: let it get unloaded?
+                    delete pLibrary;
                 }
 #else
                 bRet = ImportPPT( &mrDocument, *pDocStream, *pStorage, mrMedium );
commit b497655a48f75ef377ac7428ef64bcb3c7bf51e4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 12 10:04:47 2016 +0100

    Fix memory leak
    
    Change-Id: I9e271c3b7ff49d33f4f6f3f8c50b70ac5ce1541e

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 1162815..c34f8dc 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -122,6 +122,7 @@
 #include <algorithm>
 #include <cassert>
 #include <set>
+#include <utility>
 #include <rtl/strbuf.hxx>
 #include <tools/time.hxx>
 #include <memory>
@@ -1219,12 +1220,12 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
                     }
                     if (nRowCount > 0)
                     {
-                        sal_uInt32* pTableArry = new sal_uInt32[ nRowCount + 2 ];
+                        std::unique_ptr<sal_uInt32[]> pTableArry(new sal_uInt32[ nRowCount + 2 ]);
                         pTableArry[ 0 ] = nTableProperties;
                         pTableArry[ 1 ] = nRowCount;
                         for ( i = 0; i < nRowCount; i++ )
                             rSt.ReadUInt32( pTableArry[ i + 2 ] );
-                        rData.pTableRowProperties = pTableArry;
+                        rData.pTableRowProperties = std::move(pTableArry);
                     }
                 }
             }
@@ -2862,12 +2863,12 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
                                                 Rectangle aEmpty;
                                                 aShapeHd.SeekToBegOfRecord( rStCtrl );
                                                 sal_Int32 nShapeId;
-                                                aProcessData.pTableRowProperties = nullptr;
+                                                aProcessData.pTableRowProperties.reset();
                                                 SdrObject* pObj = ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aEmpty, aEmpty, 0, &nShapeId );
                                                 if ( pObj )
                                                 {
                                                     if ( aProcessData.pTableRowProperties )
-                                                        pObj = CreateTable( pObj, aProcessData.pTableRowProperties, aProcessData.rPersistEntry.pSolverContainer );
+                                                        pObj = CreateTable( pObj, aProcessData.pTableRowProperties.get(), aProcessData.rPersistEntry.pSolverContainer );
 
                                                     pRet->NbcInsertObject( pObj );
 
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 9633234..d1a1078 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -508,13 +508,11 @@ struct ProcessData
     PptSlidePersistEntry&       rPersistEntry;
     SdPageCapsule               pPage;
     ::std::vector< SdrObject* > aBackgroundColoredObjects;
-    sal_uInt32*                 pTableRowProperties;
+    std::unique_ptr<sal_uInt32[]> pTableRowProperties;
 
     ProcessData( PptSlidePersistEntry& rP, SdPageCapsule pP ) :
         rPersistEntry               ( rP ),
-        pPage                       ( pP ),
-        pTableRowProperties         ( nullptr ) {};
-    ~ProcessData() { delete[] pTableRowProperties; };
+        pPage                       ( pP ) {};
 };
 
 


More information about the Libreoffice-commits mailing list