diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 16:03:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 10:16:35 +0200 |
commit | 812aa0512d0f77673b4ccda1187cccd0c9352e48 (patch) | |
tree | ab58320a31f15e32b6168f82898c020c266d4e17 /vcl | |
parent | a9286f445d15207069799655ef59267d5d371c65 (diff) |
loplugin:useuniqueptr in PspSalInfoPrinter
Change-Id: I77494fca8f0c326aa35872640b99596597116ef2
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/genprn.h | 2 | ||||
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 14 |
2 files changed, 5 insertions, 11 deletions
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index 4a1c2db0a538..f741ca03effb 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -30,7 +30,7 @@ class GenPspGraphics; class VCL_DLLPUBLIC PspSalInfoPrinter : public SalInfoPrinter { public: - GenPspGraphics* m_pGraphics; + std::unique_ptr<GenPspGraphics> m_pGraphics; psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 77abd94f6cbf..617eedc46eb6 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -480,11 +480,6 @@ PspSalInfoPrinter::PspSalInfoPrinter() PspSalInfoPrinter::~PspSalInfoPrinter() { - if( m_pGraphics ) - { - delete m_pGraphics; - m_pGraphics = nullptr; - } } void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* ) @@ -524,19 +519,18 @@ SalGraphics* PspSalInfoPrinter::AcquireGraphics() SalGraphics* pRet = nullptr; if( ! m_pGraphics ) { - m_pGraphics = GetGenericInstance()->CreatePrintGraphics(); + m_pGraphics.reset( GetGenericInstance()->CreatePrintGraphics() ); m_pGraphics->Init(&m_aJobData, &m_aPrinterGfx); - pRet = m_pGraphics; + pRet = m_pGraphics.get(); } return pRet; } void PspSalInfoPrinter::ReleaseGraphics( SalGraphics* pGraphics ) { - if( pGraphics == m_pGraphics ) + if( m_pGraphics.get() == pGraphics ) { - delete pGraphics; - m_pGraphics = nullptr; + m_pGraphics.reset(); } } |