summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-02-24 10:17:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-24 19:21:53 +0100
commit18e9e6d3dfa36afcc6c287578083948149d5aa4c (patch)
tree74fb4d5b12c7140cc5b12b29cbd80f8771512d6d
parente7c723765c90b4a6d1918f6964d15f101b80a88e (diff)
use unique_ptr in WinSalBitmap::AcquireBuffer
Change-Id: I1fca86f6d1f9bd64238b8e75cd98f53df99f91bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111447 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/win/gdi/salbmp.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index b0dffd5394dd..0d9dba981ae7 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -791,7 +791,7 @@ HANDLE WinSalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB )
BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
{
- BitmapBuffer* pBuffer = nullptr;
+ std::unique_ptr<BitmapBuffer> pBuffer;
if( mhDIB )
{
@@ -826,7 +826,7 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
if( pBIH->biPlanes == 1 )
{
- pBuffer = new BitmapBuffer;
+ pBuffer.reset(new BitmapBuffer);
pBuffer->mnFormat = pBIH->biBitCount == 1 ? ScanlineFormat::N1BitMsbPal :
pBIH->biBitCount == 4 ? ScanlineFormat::N4BitMsnPal :
@@ -894,15 +894,14 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
else
{
GlobalUnlock( mhDIB );
- delete pBuffer;
- pBuffer = nullptr;
+ pBuffer.reset();
}
}
else
GlobalUnlock( mhDIB );
}
- return pBuffer;
+ return pBuffer.release();
}
void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode )