diff options
Diffstat (limited to 'vcl/win/gdi/salprn.cxx')
-rw-r--r-- | vcl/win/gdi/salprn.cxx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 365bf44c06e4..4775e804f2f9 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -396,16 +396,17 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe } // Release mutex, in the other case we don't get paints and so on - sal_uLong nMutexCount=0; - if ( pVisibleDlgParent ) - nMutexCount = ImplSalReleaseYieldMutex(); + sal_uInt32 nMutexCount = 0; + WinSalInstance* pInst = GetSalData()->mpFirstInstance; + if ( pInst && pVisibleDlgParent ) + nMutexCount = pInst->ReleaseYieldMutex( true ); BYTE* pOutDevMode = (reinterpret_cast<BYTE*>(pOutBuffer) + pOutBuffer->mnDriverOffset); nRet = DocumentPropertiesW( hWnd, hPrn, pPrinterNameW, reinterpret_cast<LPDEVMODEW>(pOutDevMode), reinterpret_cast<LPDEVMODEW>(const_cast<BYTE *>(pInBuffer)), nMode ); - if ( pVisibleDlgParent ) - ImplSalAcquireYieldMutex( nMutexCount ); + if ( pInst && pVisibleDlgParent ) + pInst->AcquireYieldMutex( nMutexCount ); ClosePrinter( hPrn ); if( (nRet < 0) || (pVisibleDlgParent && (nRet == IDCANCEL)) ) @@ -1522,6 +1523,14 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, return TRUE; } +void WinSalPrinter::DoEndDoc(HDC hDC) +{ + CATCH_DRIVER_EX_BEGIN; + if( ::EndDoc( hDC ) <= 0 ) + GetLastError(); + CATCH_DRIVER_EX_END( "exception in EndDoc", this ); +} + bool WinSalPrinter::EndJob() { HDC hDC = mhDC; @@ -1540,13 +1549,10 @@ bool WinSalPrinter::EndJob() // it should be safe to release the yield mutex over the EndDoc // call, however the real solution is supposed to be the threading // framework yet to come. - volatile sal_uLong nAcquire = GetSalData()->mpFirstInstance->ReleaseYieldMutex(); - CATCH_DRIVER_EX_BEGIN; - if( ::EndDoc( hDC ) <= 0 ) - GetLastError(); - CATCH_DRIVER_EX_END( "exception in EndDoc", this ); - - GetSalData()->mpFirstInstance->AcquireYieldMutex( nAcquire ); + { + SolarMutexReleaser aReleaser; + DoEndDoc( hDC ); + } DeleteDC( hDC ); mhDC = nullptr; } |