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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 20 17:56:12 UTC 2018


 vcl/win/gdi/gdiimpl.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 5d0b961b1962474fd5c5be9a6a064114a710bc1b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 19 17:34:39 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 20 19:55:51 2018 +0200

    use std::unique_ptr
    
    Change-Id: I8645d1d0776f7b7f2cd6e6d18f387210c6e126d9
    Reviewed-on: https://gerrit.libreoffice.org/62068
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 3962c4d4a52d..1ba590cc803e 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -579,14 +579,14 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
     {
         HGLOBAL     hDrawDIB;
         HBITMAP     hDrawDDB = rSalBitmap.ImplGethDDB();
-        WinSalBitmap*   pTmpSalBmp = nullptr;
+        std::unique_ptr<WinSalBitmap> xTmpSalBmp;
         bool        bPrintDDB = ( bPrinter && hDrawDDB );
 
         if( bPrintDDB )
         {
-            pTmpSalBmp = new WinSalBitmap;
-            pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
-            hDrawDIB = pTmpSalBmp->ImplGethDIB();
+            xTmpSalBmp.reset(new WinSalBitmap);
+            xTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
+            hDrawDIB = xTmpSalBmp->ImplGethDIB();
         }
         else
             hDrawDIB = rSalBitmap.ImplGethDIB();
@@ -670,9 +670,6 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
 
             ImplReleaseCachedDC( CACHED_HDC_DRAW );
         }
-
-        if( bPrintDDB )
-            delete pTmpSalBmp;
     }
 }
 


More information about the Libreoffice-commits mailing list