vcl/win/gdi/salprn.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
New commits: commit 98a35222bdc0b4dcf146c40248799addd2fbf510 Author: Noel Grandin <[email protected]> AuthorDate: Mon Nov 13 13:13:42 2023 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Nov 30 12:25:07 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 <[email protected]> Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit 07dfeffae8cba808dbad85dfed9b6a693a1f9543) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160044 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 71e4753995ae..7f9c0a5a72e8 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1382,7 +1382,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; @@ -1391,6 +1391,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&,
