initialize mnRefCount members directly in ctors

Change-Id: I7b4ff643eb256519bc47d27f6e0a6a60aaf8768e
This commit is contained in:
Caolán McNamara
2014-02-13 17:07:09 +00:00
parent 811e6f6745
commit 29a95776c3
2 changed files with 6 additions and 7 deletions

View File

@@ -168,7 +168,6 @@ void Image::ImplInit( const BitmapEx& rBmpEx )
if( !rBmpEx.IsEmpty() ) if( !rBmpEx.IsEmpty() )
{ {
mpImplData = new ImplImage; mpImplData = new ImplImage;
mpImplData->mnRefCount = 1;
if( rBmpEx.GetTransparentType() == TRANSPARENT_NONE ) if( rBmpEx.GetTransparentType() == TRANSPARENT_NONE )
{ {
@@ -365,7 +364,6 @@ ImageList::ImageList( const ImageList& rImageList ) :
ImageList::~ImageList() ImageList::~ImageList()
{ {
if( mpImplData && ( 0 == --mpImplData->mnRefCount ) ) if( mpImplData && ( 0 == --mpImplData->mnRefCount ) )
delete mpImplData; delete mpImplData;
} }
@@ -373,7 +371,6 @@ ImageList::~ImageList()
void ImageList::ImplInit( sal_uInt16 nItems, const Size &rSize ) void ImageList::ImplInit( sal_uInt16 nItems, const Size &rSize )
{ {
mpImplData = new ImplImageList; mpImplData = new ImplImageList;
mpImplData->mnRefCount = 1;
mpImplData->maImages.reserve( nItems ); mpImplData->maImages.reserve( nItems );
mpImplData->maImageSize = rSize; mpImplData->maImageSize = rSize;
} }

View File

@@ -58,13 +58,14 @@ ImageAryData& ImageAryData::operator=( const ImageAryData& rData )
} }
ImplImageList::ImplImageList() ImplImageList::ImplImageList()
: mnRefCount(1)
{ {
} }
ImplImageList::ImplImageList( const ImplImageList &aSrc ) : ImplImageList::ImplImageList( const ImplImageList &aSrc )
maPrefix( aSrc.maPrefix ), : maPrefix(aSrc.maPrefix)
maImageSize( aSrc.maImageSize ), , maImageSize(aSrc.maImageSize)
mnRefCount( 1 ) , mnRefCount(1)
{ {
maImages.reserve( aSrc.maImages.size() ); maImages.reserve( aSrc.maImages.size() );
for ( ImageAryDataVec::const_iterator aIt = aSrc.maImages.begin(), aEnd = aSrc.maImages.end(); aIt != aEnd; ++aIt ) 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() ImplImage::ImplImage()
: mnRefCount(1)
{ {
} }