diff options
author | Mark Hung <marklh9@gmail.com> | 2021-10-11 10:26:56 +0800 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-12 08:34:28 +0200 |
commit | d27187b158d7e3f92180b1f2ab79b048dc5318a5 (patch) | |
tree | 96b70f75d4f4e9cd06e8bd617c70c9eaf0c5ec06 /vcl | |
parent | e4913a56c07914708d8272ae211e23b73349e673 (diff) |
vcl:use unique_ptr<SalWinGraphics> in WinSalPrinter
to replace plain SalWinGraphics pointer, and get rid
of delete.
Change-Id: If06df98a8ebfdf5797bddfefa37647522b8e711b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123365
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/win/salprn.h | 2 | ||||
-rw-r--r-- | vcl/win/gdi/salprn.cxx | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index 43eaa520c23d..2d02aa5b0e54 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -78,7 +78,7 @@ public: class WinSalPrinter : public SalPrinter { public: - WinSalGraphics* mpGraphics; // current Printer graphics + std::unique_ptr<WinSalGraphics> mxGraphics; // current Printer graphics WinSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter WinSalPrinter* mpNextPrinter; // next printing printer HDC mhDC; // printer hdc diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 21e779eb6156..86e1e616a57f 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1350,7 +1350,6 @@ static DEVMODEW const * ImplSalSetCopies( DEVMODEW const * pDevMode, sal_uInt32 WinSalPrinter::WinSalPrinter() : - mpGraphics( nullptr ), mpInfoPrinter( nullptr ), mpNextPrinter( nullptr ), mhDC( nullptr ), @@ -1374,7 +1373,6 @@ WinSalPrinter::~WinSalPrinter() HDC hDC = mhDC; if ( hDC ) { - delete mpGraphics; DeleteDC( hDC ); } @@ -1531,8 +1529,7 @@ bool WinSalPrinter::EndJob() HDC hDC = mhDC; if (isValid()) { - delete mpGraphics; - mpGraphics = nullptr; + mxGraphics.reset(); // #i54419# Windows fax printer brings up a dialog in EndDoc // which text previously copied in soffice process can be @@ -1587,14 +1584,13 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobDat SelectPen( hDC, hTempPen ); SelectBrush( hDC, hTempBrush ); - mpGraphics = ImplCreateSalPrnGraphics( hDC ); - return mpGraphics; + mxGraphics.reset(ImplCreateSalPrnGraphics( hDC )); + return mxGraphics.get(); } void WinSalPrinter::EndPage() { - delete mpGraphics; - mpGraphics = nullptr; + mxGraphics.reset(); if (!isValid()) return; |