summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 14:24:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-24 08:26:57 +0200
commit63dbd42d9bdc2eba7ac45a4f5c761f0806a0ea78 (patch)
treea06a210763156cf5849afc1a06498b9a55e85ab2
parentab2b4c0e1378072f05eee6b2c1bf6df311d6f1b3 (diff)
loplugin:useuniqueptr in Printer
Change-Id: Icdc99c51fe3548f96f5da5ccd3ac88bfccffc63c Reviewed-on: https://gerrit.libreoffice.org/53354 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/vcl/print.hxx2
-rw-r--r--vcl/source/gdi/print.cxx5
2 files changed, 3 insertions, 4 deletions
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 )