sb118: fixed aqua_clipboard mutex lock scope

This commit is contained in:
sb
2010-01-13 16:04:40 +01:00
parent 24532f0855
commit ec0f00417a

View File

@@ -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);