[Libreoffice-commits] core.git: vcl/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 23 18:03:34 UTC 2021


 vcl/source/outdev/transparent.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6e01d697ef58155ea9133e2ff19df0442d30a2eb
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Tue Feb 23 15:43:30 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Feb 23 19:02:45 2021 +0100

    use unique_ptr in OutputDevice::EmulateDrawTransparent
    
    Change-Id: I45f04c49055b0bead6b966ed4e682aec70c6e7a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111402
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 49c8bfa23e07..3d37b8fe47ba 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -421,7 +421,8 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
                         {
                             const BitmapPalette& rPal = pW->GetPalette();
                             const sal_uInt16 nCount = rPal.GetEntryCount();
-                            BitmapColor* pMap = reinterpret_cast<BitmapColor*>(new sal_uInt8[ nCount * sizeof( BitmapColor ) ]);
+                            std::unique_ptr<sal_uInt8[]> xMap(new sal_uInt8[ nCount * sizeof( BitmapColor )]);
+                            BitmapColor* pMap = reinterpret_cast<BitmapColor*>(xMap.get());
 
                             for( sal_uInt16 i = 0; i < nCount; i++ )
                             {
@@ -470,7 +471,6 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,
                                     }
                                 }
                             }
-                            delete[] reinterpret_cast<sal_uInt8*>(pMap);
                         }
                         else
                         {


More information about the Libreoffice-commits mailing list