summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-01-13 16:04:40 +0100
committersb <sb@openoffice.org>2010-01-13 16:04:40 +0100
commitec0f00417aaabc0676757e310b99d3202667a37c (patch)
tree074f265d83dcaafdef6278281da26c08c4e8f864
parent24532f08558415d3520500e80db65152da3a5a61 (diff)
sb118: fixed aqua_clipboard mutex lock scope
-rw-r--r--vcl/aqua/source/dtrans/aqua_clipboard.cxx13
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
index 27bf308dce9b..386be4b508b4 100644
--- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx
+++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
@@ -192,6 +192,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf
const Reference<XClipboardOwner>& xClipboardOwner)
throw( RuntimeException )
{
+ NSArray* types = xTransferable.is() ?
+ mpDataFlavorMapper->flavorSequenceToTypesArray(xTransferable->getTransferDataFlavors()) :
+ [NSArray array];
+
ClearableMutexGuard aGuard(m_aMutex);
Reference<XClipboardOwner> oldOwner(mXClipboardOwner);
@@ -200,11 +204,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransf
Reference<XTransferable> oldContent(mXClipboardContent);
mXClipboardContent = xTransferable;
- NSArray* types = mXClipboardContent.is() ?
- mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()) :
- [NSArray array];
mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener];
+ aGuard.clear();
+
// if we are already the owner of the clipboard
// then fire lost ownership event
if (oldOwner.is())
@@ -256,7 +259,7 @@ void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboard
void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification)
{
- MutexGuard aGuard(m_aMutex);
+ ClearableMutexGuard aGuard(m_aMutex);
int currentPboardChgCount = [mPasteboard changeCount];
@@ -273,6 +276,8 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification)
Reference<XTransferable> oldContent(mXClipboardContent);
mXClipboardContent = Reference<XTransferable>();
+ aGuard.clear();
+
if (oldOwner.is())
{
fireLostClipboardOwnershipEvent(oldOwner, oldContent);