vcl/win/gdi/salprn.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 07dfeffae8cba808dbad85dfed9b6a693a1f9543
Author:     Noel Grandin <noelgran...@collabora.co.uk>
AuthorDate: Mon Nov 13 13:13:42 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 13 14:02:59 2023 +0100

    tdf#127547 Freeze in Microsoft Print to PDF dialog
    
    Change-Id: I7a6ef85fae637c8359a96df1bd31d7e8f0b36512
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159369
    Tested-by: Hossein <hoss...@libreoffice.org>
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 0631bcd37c3f..3302efa2d986 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -1375,7 +1375,7 @@ void WinSalPrinter::markInvalid()
 
 // need wrappers for StarTocW/A to use structured exception handling
 // since SEH does not mix with standard exception handling's cleanup
-static int lcl_StartDocW( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* pPrt 
)
+static int lcl_StartDocW1( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* 
pPrt )
 {
     int nRet = 0;
     CATCH_DRIVER_EX_BEGIN;
@@ -1384,6 +1384,16 @@ static int lcl_StartDocW( HDC hDC, DOCINFOW const * 
pInfo, WinSalPrinter* pPrt )
     return nRet;
 }
 
+static int lcl_StartDocW( HDC hDC, DOCINFOW const * pInfo, WinSalPrinter* pPrt 
)
+{
+    //tdf#127547 - Freeze/crash in Microsoft Print to PDF dialog, if we try to 
paste while
+    // executing the StartDocW method, Windows will call back into us on a 
separate thread,
+    // where we will attempt to take the SolarMutex.
+    SolarMutexReleaser aReleaser;
+
+    return lcl_StartDocW1(hDC, pInfo, pPrt);
+}
+
 bool WinSalPrinter::StartJob( const OUString* pFileName,
                            const OUString& rJobName,
                            const OUString&,

Reply via email to