summaryrefslogtreecommitdiffstats
path: root/dtrans/source/win32/clipb/WinClipbImpl.cxx
diff options
context:
space:
mode:
authorTino Rachui <tra@openoffice.org>2001-03-07 10:23:10 +0000
committerTino Rachui <tra@openoffice.org>2001-03-07 10:23:10 +0000
commitf8530b3c1fb7d18dbb779fa873c02de590a1cdbe (patch)
treeb31b185d2acecc5951f8bdd17aaf5c433dfca203 /dtrans/source/win32/clipb/WinClipbImpl.cxx
parent#84699#: new MimeTypes for clipboard interfaces (diff)
downloadcore-f8530b3c1fb7d18dbb779fa873c02de590a1cdbe.tar.gz
core-f8530b3c1fb7d18dbb779fa873c02de590a1cdbe.zip
#84702# using an additional condition to avoid dealocks in lostOwnership calls
Diffstat (limited to 'dtrans/source/win32/clipb/WinClipbImpl.cxx')
-rw-r--r--dtrans/source/win32/clipb/WinClipbImpl.cxx30
1 files changed, 24 insertions, 6 deletions
diff --git a/dtrans/source/win32/clipb/WinClipbImpl.cxx b/dtrans/source/win32/clipb/WinClipbImpl.cxx
index 24d9a54716d5..dd929602c624 100644
--- a/dtrans/source/win32/clipb/WinClipbImpl.cxx
+++ b/dtrans/source/win32/clipb/WinClipbImpl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: WinClipbImpl.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: tra $ $Date: 2001-03-06 13:53:37 $
+ * last change: $Author: tra $ $Date: 2001-03-07 11:23:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -178,7 +178,8 @@ Reference< XTransferable > SAL_CALL CWinClipbImpl::getContents( ) throw( Runtime
//------------------------------------------------------------------------
void SAL_CALL CWinClipbImpl::setContents( const Reference< XTransferable >& xTransferable,
- const Reference< XClipboardOwner >& xClipboardOwner )
+ const Reference< XClipboardOwner >& xClipboardOwner,
+ ClearableMutexGuard& aGuard )
throw( RuntimeException )
{
CDTransObjFactory objFactory;
@@ -195,6 +196,13 @@ void SAL_CALL CWinClipbImpl::setContents( const Reference< XTransferable >& xTra
// used to differentiate in ClipboardContentChanged handler
m_bSelfTriggered = sal_True;
+ // block other threads via a condition
+ // release the mutex before calling into
+ // windows, because another thread can't
+ // do it
+ m_pWinClipboard->m_aCondition.reset( );
+ aGuard.clear( );
+
MTASetClipboard( pIDataObj );
}
@@ -267,10 +275,17 @@ void CALLBACK CWinClipbImpl::onClipboardContentChanged( void )
Reference< XTransferable > xClipbContent;
Reference< XClipboardOwner > xClipbOwner;
- if ( s_pCWinClipbImpl->m_rOldClipbContent.is( ) && s_pCWinClipbImpl->m_rOldClipbOwner.is( ) )
+ if ( s_pCWinClipbImpl->m_rOldClipbContent.is( ) &&
+ s_pCWinClipbImpl->m_rOldClipbOwner.is( ) )
{
+ // release the condition because of expected callbacks
+ // to the clipboard service (remeber: the mutex is already
+ // released)
+ s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
+
s_pCWinClipbImpl->m_rOldClipbOwner->lostOwnership(
s_pCWinClipbImpl->m_pWinClipboard, s_pCWinClipbImpl->m_rOldClipbContent );
+
s_pCWinClipbImpl->m_rOldClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rOldClipbContent = Reference< XTransferable >( );
}
@@ -285,13 +300,16 @@ void CALLBACK CWinClipbImpl::onClipboardContentChanged( void )
s_pCWinClipbImpl->m_rCurrentClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rCurrentClipbContent = Reference< XTransferable >( );
- // release the mutex, so that a getContent call would succeed
- aGuard.clear( );
+ // release the condition because of expected callbacks
+ // to the clipboard service (remeber: the mutex is already
+ // released)
+ s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
// notify the old ClipboardOwner
xClipbOwner->lostOwnership( s_pCWinClipbImpl->m_pWinClipboard, xClipbContent );
}
+ s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
s_pCWinClipbImpl->m_bSelfTriggered = sal_False;
// reassocition to instance through static member