Commits

Philipp Lohmann [pl]  committed e088a0e

vcl115: #163153# we need to release the clipboard after flush and ignore further requests for data.

  • Participants
  • Parent commits 4a5906c

Comments (0)

Files changed (1)

File vcl/aqua/source/dtrans/aqua_clipboard.cxx

 
 void AquaClipboard::provideDataForType(NSPasteboard* sender, NSString* type)
 {
-  DataProviderPtr_t dp = mpDataFlavorMapper->getDataProvider(type, mXClipboardContent);
-  NSData* pBoardData = NULL;
-  
-  if (dp.get() != NULL)
-  {
-      pBoardData = (NSData*)dp->getSystemData();      
-      [sender setData: pBoardData forType: type];
-  }
+    if( mXClipboardContent.is() )
+    {
+        DataProviderPtr_t dp = mpDataFlavorMapper->getDataProvider(type, mXClipboardContent);
+        NSData* pBoardData = NULL;
+        
+        if (dp.get() != NULL)
+        {
+            pBoardData = (NSData*)dp->getSystemData();      
+            [sender setData: pBoardData forType: type];
+        }
+    }
 }
 
 
 void SAL_CALL AquaClipboard::flushClipboard() 
   throw(RuntimeException)
 {
-  if (mXClipboardContent.is())
+    if (mXClipboardContent.is())
 	{
 	  	Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors();	
 		sal_uInt32 nFlavors = flavorList.getLength();
 		
 		for (sal_uInt32 i = 0; i < nFlavors; i++)
-		  {
+		{
 			NSString* sysType = mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
 			
 			if (sysType != NULL)
-			  {
+			{
 				provideDataForType(mPasteboard, sysType);
-			  }
-		  }
+			}
+		}
+		mXClipboardContent.clear();
 	}
 }