summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/sallayout.cxx
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/sallayout.cxx
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/sallayout.cxx')
-rw-r--r--vcl/source/gdi/sallayout.cxx14
1 files changed, 2 insertions, 12 deletions
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
{