summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2017-06-07 04:38:27 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-06-07 13:52:17 +0200
commitcb9be0e492d047648185ae80553220fd9b538746 (patch)
treec8ae318427e59c3c32fed32080903f5e442bc579 /vcl/source/gdi
parent61c3e678f4efb19fb2396de43075cf6a1e0afd99 (diff)
Replace vcl::SalLayout Release with destructor
Replace SalLayout::Release() with normal destructor mechanism. Release() uses reference counting for the layout. But in practice, the reference counting variable is initialized in ctor and is not incremented elsewhere. So I removed the Release() method and replaced all the Release() calls with 'delete'. It will make easier the use of smart pointers and decrease the chance of memory leaks. Change-Id: Ia2e142dea10b87e232d5757d84778e62d87cf081 Reviewed-on: https://gerrit.libreoffice.org/38488 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx6
-rw-r--r--vcl/source/gdi/print2.cxx4
-rw-r--r--vcl/source/gdi/sallayout.cxx14
3 files changed, 7 insertions, 17 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 41749131ace9..87d536b8f848 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8877,7 +8877,7 @@ void PDFWriterImpl::drawText( const Point& rPos, const OUString& rText, sal_Int3
if( pLayout )
{
drawLayout( *pLayout, rText, bTextLines );
- pLayout->Release();
+ delete pLayout;
}
}
@@ -8893,7 +8893,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, const OUString& rText, con
if( pLayout )
{
drawLayout( *pLayout, rText, true );
- pLayout->Release();
+ delete pLayout;
}
}
@@ -8909,7 +8909,7 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, sal_uLong nWidth, const
if( pLayout )
{
drawLayout( *pLayout, rText, true );
- pLayout->Release();
+ delete pLayout;
}
}
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 74ab167ecbdd..576c564652ec 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -592,7 +592,7 @@ tools::Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
{
tools::Rectangle aBoundRect( const_cast<OutputDevice&>(rOut).ImplGetTextBoundRect( *pSalLayout ) );
aActionBounds = rOut.PixelToLogic( aBoundRect );
- pSalLayout->Release();
+ delete pSalLayout;
}
}
}
@@ -622,7 +622,7 @@ tools::Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
{
tools::Rectangle aBoundRect( const_cast<OutputDevice&>(rOut).ImplGetTextBoundRect( *pSalLayout ) );
aActionBounds = rOut.PixelToLogic( aBoundRect );
- pSalLayout->Release();
+ delete pSalLayout;
}
}
}
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 11e1d307eb73..30907d8a62ad 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -545,7 +545,6 @@ SalLayout::SalLayout()
mnLayoutFlags( SalLayoutFlags::NONE ),
mnUnitsPerPixel( 1 ),
mnOrientation( 0 ),
- mnRefCount( 1 ),
maDrawOffset( 0, 0 )
{}
@@ -560,15 +559,6 @@ void SalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
mnOrientation = rArgs.mnOrientation;
}
-void SalLayout::Release() const
-{
- // TODO: protect when multiple threads can access this
- if( --mnRefCount > 0 )
- return;
- // const_cast because some compilers violate ANSI C++ spec
- delete this;
-}
-
Point SalLayout::GetDrawPosition( const Point& rRelative ) const
{
Point aPos = maDrawBase;
@@ -1056,7 +1046,7 @@ void MultiSalLayout::SetIncomplete(bool bIncomplete)
MultiSalLayout::~MultiSalLayout()
{
for( int i = 0; i < mnLevel; ++i )
- mpLayouts[ i ]->Release();
+ delete mpLayouts[ i ];
}
void MultiSalLayout::AddFallback( SalLayout& rFallback,
@@ -1199,7 +1189,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( (n > 0) && !nValid[ nLevel ] )
{
// an empty fallback layout can be released
- mpLayouts[n]->Release();
+ delete mpLayouts[n];
}
else
{