From 29a95776c3151e679bb8e5224cf4268c36859bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 13 Feb 2014 17:07:09 +0000 Subject: [PATCH] initialize mnRefCount members directly in ctors Change-Id: I7b4ff643eb256519bc47d27f6e0a6a60aaf8768e --- vcl/source/gdi/image.cxx | 3 --- vcl/source/gdi/impimage.cxx | 10 ++++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 4b4b204ce4fe..2a17f5140771 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -168,7 +168,6 @@ void Image::ImplInit( const BitmapEx& rBmpEx ) if( !rBmpEx.IsEmpty() ) { mpImplData = new ImplImage; - mpImplData->mnRefCount = 1; if( rBmpEx.GetTransparentType() == TRANSPARENT_NONE ) { @@ -365,7 +364,6 @@ ImageList::ImageList( const ImageList& rImageList ) : ImageList::~ImageList() { - if( mpImplData && ( 0 == --mpImplData->mnRefCount ) ) delete mpImplData; } @@ -373,7 +371,6 @@ ImageList::~ImageList() void ImageList::ImplInit( sal_uInt16 nItems, const Size &rSize ) { mpImplData = new ImplImageList; - mpImplData->mnRefCount = 1; mpImplData->maImages.reserve( nItems ); mpImplData->maImageSize = rSize; } diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx index f61a34588f27..7f77d10a07cd 100644 --- a/vcl/source/gdi/impimage.cxx +++ b/vcl/source/gdi/impimage.cxx @@ -58,13 +58,14 @@ ImageAryData& ImageAryData::operator=( const ImageAryData& rData ) } ImplImageList::ImplImageList() + : mnRefCount(1) { } -ImplImageList::ImplImageList( const ImplImageList &aSrc ) : - maPrefix( aSrc.maPrefix ), - maImageSize( aSrc.maImageSize ), - mnRefCount( 1 ) +ImplImageList::ImplImageList( const ImplImageList &aSrc ) + : maPrefix(aSrc.maPrefix) + , maImageSize(aSrc.maImageSize) + , mnRefCount(1) { maImages.reserve( aSrc.maImages.size() ); for ( ImageAryDataVec::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt ) @@ -116,6 +117,7 @@ sal_Bool ImplImageData::IsEqual( const ImplImageData& rData ) } ImplImage::ImplImage() + : mnRefCount(1) { }