summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/win/salprn.h2
-rw-r--r--vcl/win/gdi/salprn.cxx12
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;