vcl/inc/win/salprn.h | 2 +- vcl/win/gdi/salprn.cxx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-)
New commits: commit 3d897530d4cd24e2739c81a39984015b192d110e Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Mon Sep 20 18:11:19 2021 +0200 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Sat Sep 25 16:08:44 2021 +0200 WIN WinSalPrinter::isValid implies a valid HDC Change-Id: I7a8bb9f6666c75165ac1dcd49f14ae983b6eefe8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122372 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h index c2a47ebb941f..209f064fd157 100644 --- a/vcl/inc/win/salprn.h +++ b/vcl/inc/win/salprn.h @@ -105,7 +105,7 @@ public: virtual SalPrinterError GetErrorCode() override; void markInvalid(); - bool isValid() const { return mbValid; } + bool isValid() const { return mbValid && mhDC; } }; #endif // INCLUDED_VCL_INC_WIN_SALPRN_H diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 9e20e0dbb4c9..19e61d08ed03 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1387,7 +1387,6 @@ WinSalPrinter::~WinSalPrinter() pTempPrinter->mpNextPrinter = mpNextPrinter; } - mbValid = false; } void WinSalPrinter::markInvalid() @@ -1527,7 +1526,7 @@ void WinSalPrinter::DoEndDoc(HDC hDC) bool WinSalPrinter::EndJob() { HDC hDC = mhDC; - if ( isValid() && hDC ) + if (isValid()) { delete mpGraphics; mpGraphics = nullptr; @@ -1551,7 +1550,7 @@ bool WinSalPrinter::EndJob() SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) { - if( ! isValid() || mhDC == nullptr ) + if (!isValid()) return nullptr; HDC hDC = mhDC; @@ -1594,7 +1593,7 @@ void WinSalPrinter::EndPage() delete mpGraphics; mpGraphics = nullptr; - if( ! isValid() ) + if (!isValid()) return; HDC hDC = mhDC;