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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Jan 20 14:26:27 UTC 2017


 sc/source/ui/view/preview.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 110a62e91fb39ab30706398ab78cde03e8bf6e45
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu Jan 19 17:38:39 2017 +0100

    sc: use unique_ptr and make_unique instead of new/delete
    
    Change-Id: Iafaf78d17fc5d6dffbd4e541f802b7090dcfda68
    Reviewed-on: https://gerrit.libreoffice.org/33344
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Tested-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index a171889..3a5b1d0 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -32,6 +32,7 @@
 #include <tools/multisel.hxx>
 #include <vcl/waitobj.hxx>
 #include <vcl/settings.hxx>
+#include <o3tl/make_unique.hxx>
 
 #include "preview.hxx"
 #include "prevwsh.hxx"
@@ -391,11 +392,11 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
     {
         ScPrintOptions aOptions = pScMod->GetPrintOptions();
 
-        ScPrintFunc* pPrintFunc;
+        std::unique_ptr<ScPrintFunc> pPrintFunc;
         if (bStateValid)
-            pPrintFunc = new ScPrintFunc( this, pDocShell, aState, &aOptions );
+            pPrintFunc = o3tl::make_unique<ScPrintFunc>( this, pDocShell, aState, &aOptions );
         else
-            pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions );
+            pPrintFunc = o3tl::make_unique<ScPrintFunc>( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions );
 
         pPrintFunc->SetOffset(aOffset);
         pPrintFunc->SetManualZoom(nZoom);
@@ -478,7 +479,6 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
             aState.nDocPages = nTotalPages;
             bStateValid = true;
         }
-        delete pPrintFunc;
     }
 
     if ( bDoPrint )


More information about the Libreoffice-commits mailing list