[Libreoffice-commits] core.git: 3 commits - sfx2/source svtools/source svx/source

2014-05-16 Thread Caolán McNamara
 sfx2/source/doc/sfxbasemodel.cxx   |   12 +++-
 svtools/source/graphic/grfcache.cxx|2 +-
 svx/source/sdr/properties/itemsettools.cxx |1 +
 3 files changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 5b2f1b46b129c41890c54513c6d386407db6718a
Author: Caolán McNamara caol...@redhat.com
Date:   Fri May 16 20:50:24 2014 +0100

strangely obvious leaky code

Change-Id: I968cbb784d53e0cff0649061c58f752939226a09

diff --git a/svx/source/sdr/properties/itemsettools.cxx 
b/svx/source/sdr/properties/itemsettools.cxx
index ce937b3..2879b48 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -120,6 +120,7 @@ namespace sdr
 SfxPoolItem* pNewItem = pItem-Clone();
 pNewItem-ScaleMetrics(nMul, nDiv);
 rSet.Put(*pNewItem);
+delete pNewItem;
 }
 }
 nWhich = aIter.NextWhich();
commit fdca15fb864aca975533257d5ee83440992d8a7e
Author: Caolán McNamara caol...@redhat.com
Date:   Fri May 16 16:36:13 2014 +0100

valgrind: SfxBaseModel's pImpl of fallback TargetDocument for paste leaks

e.g. repeatedly pasting a metafile into writer and deleting it.

==13369== 342 (232 direct, 110 indirect) bytes in 1 blocks are definitely 
lost in loss record 19,396 of 22,170
==13369==at 0x4A06965: operator new(unsigned long) (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==13369==by 0x686D72E: SfxBaseModel::SfxBaseModel(SfxObjectShell*) 
(sfxbasemodel.cxx:518)
==13369==by 0x288CA9C1: 
SvxUnoDrawingModel::SvxUnoDrawingModel(SdrModel*) (unomod.cxx:255)
==13369==by 0x28961055: SvxDrawingLayerImport(SdrModel*, 
com::sun::star::uno::Referencecom::sun::star::io::XInputStream const, 
com::sun::star::uno::Referencecom::sun::star::lang::XComponent const, char 
const*) (xmlexport.cxx:164)
==13369==by 0x28960FA2: SvxDrawingLayerImport(SdrModel*, 
com::sun::star::uno::Referencecom::sun::star::io::XInputStream const, 
com::sun::star::uno::Referencecom::sun::star::lang::XComponent const) 
(xmlexport.cxx:148)
==13369==by 0x2896175E: SvxDrawingLayerImport(SdrModel*, 
com::sun::star::uno::Referencecom::sun::star::io::XInputStream const) 
(xmlexport.cxx:254)
==13369==by 0x240B1002: SwFEShell::Paste(SvStream, unsigned short, 
Point const*) (fecopy.cxx:1333)
==13369==by 0x247B981A: 
SwTransferable::_PasteSdrFormat(TransferableDataHelper, SwWrtShell, unsigned 
short, Point const*, unsigned char, bool) (swdtflvr.cxx:2207)
==13369==by 0x247B678E: 
SwTransferable::PasteData(TransferableDataHelper, SwWrtShell, unsigned short, 
unsigned long, unsigned short, bool, bool, Point const*, signed char, bool) 
(swdtflvr.cxx:1481)
==13369==by 0x247B5AE4: SwTransferable::Paste(SwWrtShell, 
TransferableDataHelper) (swdtflvr.cxx:1150)
==13369==by 0x2488FCCE: SwBaseShell::ExecClpbrd(SfxRequest) 
(basesh.cxx:277)

 Reference lang::XComponent  xTargetDocument( xComponent );
 if( !xTargetDocument.is() )
 {
xTargetDocument = new SvxUnoDrawingModel( pModel );
 pModel-setUnoModel( Reference XInterface ::query( 
xTargetDocument ) );
 }

Change-Id: I3bd0fc983d9b6bdcdc91071a4ec3d2c584397ebf

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 3ad6fc9..b50afe1 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -523,18 +523,15 @@ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell )
 }
 }
 
-
 //  destructor
-
-
 SfxBaseModel::~SfxBaseModel()
 {
+//In SvxDrawingLayerImport when !xTargetDocument the fallback 
SvxUnoDrawingModel created there
+//never gets disposed called on it, so m_pData leaks.
+delete m_pData, m_pData = 0;
 }
 
-
 //  XInterface
-
-
 Any SAL_CALL SfxBaseModel::queryInterface( const uno::Type rType ) throw( 
RuntimeException, std::exception )
 {
 if  (   ( !m_bSupportEmbeddedScripts  rType.equals( 
cppu::UnoTypedocument::XEmbeddedScripts::get() ) )
@@ -545,10 +542,7 @@ Any SAL_CALL SfxBaseModel::queryInterface( const 
uno::Type rType ) throw( Runti
 return SfxBaseModel_Base::queryInterface( rType );
 }
 
-
 //  XInterface
-
-
 void SAL_CALL SfxBaseModel::acquire() throw( )
 {
 // Attention:
commit 7d6e159df4c28afde2fff5bd734ec3a8f63cb15a
Author: Caolán McNamara caol...@redhat.com
Date:   Fri May 16 16:06:10 2014 +0100

fix memory leak on pasting metafiles into writer

copying from mspaint to writer and then deleting the image in a loop will
eventually exhaust all memory.

regression since 004a29b9ac66f68af5ea12a2303a4b2be77d8145

Change-Id: I381285cda3823de7df0c1725a339943caf9536fe

diff --git a/svtools/source/graphic/grfcache.cxx 
b/svtools/source/graphic/grfcache.cxx
index 26d766a..72fdc3a 100644
--- 

[Libreoffice-commits] core.git: 3 commits - sfx2/source svtools/source

2014-02-12 Thread Caolán McNamara
 sfx2/source/control/bindings.cxx  |2 +-
 svtools/source/brwbox/brwbox2.cxx |2 +-
 svtools/source/misc/itemdel.cxx   |   22 +-
 3 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 9cbc25dd6e31fc5fd2a25067fe924626451f9376
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Feb 12 14:24:48 2014 +

Revert coverity#736486 try and make coverity see through this better

This reverts commit a0bae848d42b675e4638420d632d710ed3cf76c3.

diff --git a/svtools/source/misc/itemdel.cxx b/svtools/source/misc/itemdel.cxx
index d6f7d65..ad56240 100644
--- a/svtools/source/misc/itemdel.cxx
+++ b/svtools/source/misc/itemdel.cxx
@@ -38,13 +38,12 @@ class SfxItemDesruptor_Impl
 Link aLink;
 
 private:
-DECL_LINK( Delete, SfxItemDesruptor_Impl * );
-SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl ); // n.i.
+ DECL_LINK( Delete, void * );
+ SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl ); // n.i.
 
 public:
-SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt );
-void LaunchDeleteOnIdle();
-~SfxItemDesruptor_Impl();
+ SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt );
+ ~SfxItemDesruptor_Impl();
 };
 
 // 
@@ -56,10 +55,7 @@ SfxItemDesruptor_Impl::SfxItemDesruptor_Impl( SfxPoolItem 
*pItemToDesrupt ):
 
 DBG_ASSERT( 0 == pItem-GetRefCount(), disrupting pooled item );
 pItem-SetKind( SFX_ITEMS_DELETEONIDLE );
-}
 
-void SfxItemDesruptor_Impl::LaunchDeleteOnIdle()
-{
 // process in Idle
 GetpApp()-InsertIdleHdl( aLink, 1 );
 }
@@ -79,18 +75,18 @@ SfxItemDesruptor_Impl::~SfxItemDesruptor_Impl()
 }
 
 // 
-IMPL_LINK(SfxItemDesruptor_Impl, Delete, SfxItemDesruptor_Impl*, pImpl)
+IMPL_LINK_NOARG(SfxItemDesruptor_Impl, Delete)
 {
 {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);}
-delete pImpl;
+delete this;
 return 0;
 }
 
-void DeleteItemOnIdle(SfxPoolItem* pItem)
+// 
+void DeleteItemOnIdle( SfxPoolItem* pItem )
 {
 DBG_ASSERT( 0 == pItem-GetRefCount(), deleting item in use );
-SfxItemDesruptor_Impl *pDesruptor = new SfxItemDesruptor_Impl(pItem);
-pDesruptor-LaunchDeleteOnIdle();
+new SfxItemDesruptor_Impl( pItem );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 27fae00bf28def2c23228101dac7cf8280c498b5
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Feb 12 13:10:20 2014 +

coverity#441136 Dereference after null check

Change-Id: I81a1a70094ae6b4ed685ae3fe88c645b160955bf

diff --git a/svtools/source/brwbox/brwbox2.cxx 
b/svtools/source/brwbox/brwbox2.cxx
index 1760056e..26438c0 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -829,7 +829,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point 
rPos, const Size rSize,
 pBar-Draw(pDev, aHeaderPos, aHeaderSize, nFlags);
 
 // draw the upper left cell (the intersection between the header bar 
and the handle column)
-if (( pFirstCol-GetId() == 0 )  ( pFirstCol-Width()  4 ))
+if (pFirstCol  (pFirstCol-GetId() == 0)  (pFirstCol-Width()  4))
 {
 ButtonFrame aButtonFrame( aRealPos,
 Size( pFirstCol-Width()-1, nTitleHeight-1 ),
commit 2842e32490ad23602065e29d2cfe38adfeb483cb
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Feb 12 13:09:09 2014 +

coverity#441125 Dereference after null check

Change-Id: Ia8046dc20ff46612ad3ffeba098bee079858e8da

diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 905fcfe..a441dfa 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1609,7 +1609,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
 pDispatcher-Update_Impl();
 
 // modifying the SfxObjectInterface-stack without SfxBindings = nothing 
to do
-SfxViewFrame* pFrame = pDispatcher-GetFrame();
+SfxViewFrame* pFrame = pDispatcher ? pDispatcher-GetFrame() : NULL;
 if ( (pFrame  !pFrame-GetObjectShell()-AcceptStateUpdate()) || 
pSfxApp-IsDowning() || pImp-pCaches-empty() )
 {
 DBG_PROFSTOP(SfxBindingsNextJob_Impl0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits