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

Noel Grandin noel.grandin at collabora.co.uk
Tue Apr 24 06:27:17 UTC 2018


 include/vcl/print.hxx    |    2 +-
 vcl/source/gdi/print.cxx |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 63dbd42d9bdc2eba7ac45a4f5c761f0806a0ea78
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 23 14:24:38 2018 +0200

    loplugin:useuniqueptr in Printer
    
    Change-Id: Icdc99c51fe3548f96f5da5ccd3ac88bfccffc63c
    Reviewed-on: https://gerrit.libreoffice.org/53354
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 0c14fb3f2955..c80b514b05df 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -187,7 +187,7 @@ private:
     VclPtr<Printer>             mpPrev;
     VclPtr<Printer>             mpNext;
     VclPtr<VirtualDevice>       mpDisplayDev;
-    PrinterOptions*             mpPrinterOptions;
+    std::unique_ptr<PrinterOptions> mpPrinterOptions;
     OUString                    maPrinterName;
     OUString                    maDriver;
     OUString                    maPrintFile;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index b697e9e01557..fa43dedea7a4 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -483,7 +483,7 @@ void Printer::ImplInitData()
     mpInfoPrinter       = nullptr;
     mpPrinter           = nullptr;
     mpDisplayDev        = nullptr;
-    mpPrinterOptions    = new PrinterOptions;
+    mpPrinterOptions.reset(new PrinterOptions);
 
     // Add printer to the list
     ImplSVData* pSVData = ImplGetSVData();
@@ -943,8 +943,7 @@ void Printer::dispose()
     SAL_WARN_IF( IsPrinting(), "vcl.gdi", "Printer::~Printer() - Job is printing" );
     SAL_WARN_IF( IsJobActive(), "vcl.gdi", "Printer::~Printer() - Job is active" );
 
-    delete mpPrinterOptions;
-    mpPrinterOptions = nullptr;
+    mpPrinterOptions.reset();
 
     ReleaseGraphics();
     if ( mpInfoPrinter )


More information about the Libreoffice-commits mailing list