vcl/source/gdi/print.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 354706e3f5c05294af6e0000d5b9f814cfe01741
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Wed Oct 6 23:17:43 2021 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Thu Oct 7 13:27:06 2021 +0200

    tdf#144952 VCL fix the Printer graphics release
    
    Regression from commit 1b7c53db87bb67eeb2591fbb186f7ac20eb00c68
    ("WIN lazy init WinSalInfoPrinter graphics"), which removed the
    // HACK to fix an urgent P1 printing issue fast
    
    SalPrinter::StartPage returns a SalGraphics to the VCL Printer
    object. On Windows SalPrinter::EndPage deletes the SalPrinter's
    SalGraphics. MacOS keeps a single SalGraphics for the whole
    SalPrinter lifetime. PspSalPrinter stores it in a unique_ptr
    and always resets it in StartPage.
    
    But in any case the VCL Printer's SalGraphics reference must be
    freed before calling a function, which might delete it.
    
    Change-Id: Ice528b2bbc89eaadff576420bf210ea4ec1e58d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123199
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 981dd6ec76b6..f9f25c110917 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1564,8 +1564,8 @@ void Printer::ImplEndPage()
 
     if ( mpPrinter )
     {
-        mpPrinter->EndPage();
         ReleaseGraphics();
+        mpPrinter->EndPage();
         mbDevOutput = false;
 
         mpJobGraphics = nullptr;

Reply via email to