diff options
author | Pranav Kant <pranav913@gmail.com> | 2015-03-17 12:56:54 +0530 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-20 12:18:02 +0000 |
commit | 33de587e95dddfc8e3c89b84f90b3d1bca823dae (patch) | |
tree | c65ada218c27ae4f2e80b4e3476b67c8e4554ef8 /svtools/source/misc | |
parent | 9e2e9453cbca9399e1c670b354cfc3c23d70307f (diff) |
tdf#88230: cleanup solar mutex yielding
Use SolarMutexReleaser, instead.
Change-Id: I276459c42b688813ea168d6fc80466a07a5ecba4
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svtools/source/misc')
-rw-r--r-- | svtools/source/misc/transfer.cxx | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4e0ef5c3cb06..9de9349cfa1d 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -571,7 +571,7 @@ void TransferableHelper::ImplFlush() if( mxClipboard.is() ) { Reference< XFlushableClipboard > xFlushableClipboard( mxClipboard, UNO_QUERY ); - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + SolarMutexReleaser aReleaser; try { @@ -582,8 +582,6 @@ void TransferableHelper::ImplFlush() { OSL_FAIL( "Could not flush clipboard" ); } - - Application::AcquireSolarMutex( nRef ); } } @@ -1019,7 +1017,7 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const if( mxClipboard.is() && !mxTerminateListener.is() ) { - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + SolarMutexReleaser aReleaser; try { @@ -1032,8 +1030,6 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const catch( const ::com::sun::star::uno::Exception& ) { } - - Application::AcquireSolarMutex( nRef ); } } @@ -1049,7 +1045,7 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const if( xSelection.is() && !mxTerminateListener.is() ) { - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + SolarMutexReleaser aReleaser; try { @@ -1062,8 +1058,6 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const catch( const ::com::sun::star::uno::Exception& ) { } - - Application::AcquireSolarMutex( nRef ); } } @@ -1092,7 +1086,7 @@ void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceAct // we can receive drag events from the system only in the main // thread #if !defined(MACOSX) - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); + SolarMutexReleaser aReleaser; #endif try @@ -1108,11 +1102,6 @@ void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceAct catch( const ::com::sun::star::uno::Exception& ) { } - - // See above for the reason of this define -#if !defined(MACOSX) - Application::AcquireSolarMutex( nRef ); -#endif } } @@ -2283,24 +2272,22 @@ TransferableDataHelper TransferableDataHelper::CreateFromSelection( vcl::Window* if( xSelection.is() ) { - const sal_uInt32 nRef = Application::ReleaseSolarMutex(); - - try - { - Reference< XTransferable > xTransferable( xSelection->getContents() ); + SolarMutexReleaser aReleaser; - if( xTransferable.is() ) + try { - aRet = TransferableDataHelper( xTransferable ); - aRet.mxClipboard = xSelection; - } - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - - Application::AcquireSolarMutex( nRef ); - } + Reference< XTransferable > xTransferable( xSelection->getContents() ); + + if( xTransferable.is() ) + { + aRet = TransferableDataHelper( xTransferable ); + aRet.mxClipboard = xSelection; + } + } + catch( const ::com::sun::star::uno::Exception& ) + { + } + } return aRet; } |