vcl/inc/win/saldata.hxx |    6 +++---
 vcl/win/gdi/salgdi.cxx  |   18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 9cfa99594cc21ad42f3428c4e2c521dd87511fc2
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Wed Apr 12 13:40:08 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Apr 12 15:47:03 2023 +0200

    use more unique_ptr in SalData
    
    Change-Id: Ib6e5131bff38b55b2dbf0805b63ca3554c5ee349
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150278
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index 3145688e24be..2d20903d6157 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -86,9 +86,9 @@ public:
     HGLOBAL                 mhDitherDIB;            // dither memory handle
     BYTE*                   mpDitherDIB;            // dither memory
     BYTE*                   mpDitherDIBData;        // beginning of DIB data
-    tools::Long*            mpDitherDiff;           // Dither mapping table
-    BYTE*                   mpDitherLow;            // Dither mapping table
-    BYTE*                   mpDitherHigh;           // Dither mapping table
+    std::unique_ptr<tools::Long[]> mpDitherDiff;    // Dither mapping table
+    std::unique_ptr<BYTE[]> mpDitherLow;            // Dither mapping table
+    std::unique_ptr<BYTE[]> mpDitherHigh;           // Dither mapping table
     HHOOK                   mhSalObjMsgHook;        // hook to get interesting 
msg for SalObject
     HWND                    mhWantLeaveMsg;         // window handle, that 
want a MOUSELEAVE message
     AutoTimer*              mpMouseLeaveTimer;      // Timer for MouseLeave 
Test
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 630933192687..8a38a684ca35 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -180,9 +180,9 @@ void ImplInitSalGDI()
 
             pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( 
BITMAPINFOHEADER ) + 192 );
             pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( 
pSalData->mhDitherDIB ));
-            pSalData->mpDitherDiff = new tools::Long[ 256 ];
-            pSalData->mpDitherLow = new BYTE[ 256 ];
-            pSalData->mpDitherHigh = new BYTE[ 256 ];
+            pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
+            pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
+            pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
             pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( 
BITMAPINFOHEADER );
             memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
 
@@ -254,9 +254,9 @@ void ImplInitSalGDI()
 
             pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
             pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( 
pSalData->mhDitherDIB ));
-            pSalData->mpDitherDiff = new tools::Long[ 256 ];
-            pSalData->mpDitherLow = new BYTE[ 256 ];
-            pSalData->mpDitherHigh = new BYTE[ 256 ];
+            pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
+            pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
+            pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
             pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( 
BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
             memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
 
@@ -333,9 +333,9 @@ void ImplFreeSalGDI()
         GlobalUnlock( pSalData->mhDitherDIB );
         GlobalFree( pSalData->mhDitherDIB );
         pSalData->mhDitherDIB = nullptr;
-        delete[] pSalData->mpDitherDiff;
-        delete[] pSalData->mpDitherLow;
-        delete[] pSalData->mpDitherHigh;
+        pSalData->mpDitherDiff.reset();
+        pSalData->mpDitherLow.reset();
+        pSalData->mpDitherHigh.reset();
     }
 
     DeleteSysColorList();

Reply via email to