Revision: 27280
          http://sourceforge.net/p/bibdesk/svn/27280
Author:   hofman
Date:     2022-03-07 17:38:45 +0000 (Mon, 07 Mar 2022)
Log Message:
-----------
clear drag pasteboard at end of drag that may contain promises

Modified Paths:
--------------
    trunk/bibdesk/BDSKItemPasteboardHelper.m
    trunk/bibdesk/BibDocument_DataSource.m

Modified: trunk/bibdesk/BDSKItemPasteboardHelper.m
===================================================================
--- trunk/bibdesk/BDSKItemPasteboardHelper.m    2022-03-07 17:07:13 UTC (rev 
27279)
+++ trunk/bibdesk/BDSKItemPasteboardHelper.m    2022-03-07 17:38:45 UTC (rev 
27280)
@@ -263,19 +263,22 @@
 }
 
 - (void)clearPromisedTypesForPasteboard:(NSPasteboard *)pboard {
-    if ([self isProviderForPasteboard:pboard]) {
-        for (NSString *type in [[[self promisedTypesForPasteboard:pboard] 
copy] autorelease]) {
-            for (NSPasteboardItem *item in [pboard pasteboardItems]) {
-                if ([[item types] containsObject:type]) {
-                    // can raise NSPasteboardCommunicationException
-                    @try { [item setData:[NSData data] forType:type]; }
-                    @catch(id exception) { NSLog(@"ignoring exception %@ in 
-[%@ %@]", exception, [self class], NSStringFromSelector(_cmd)); }
-                    break;
+    NSArray *types = [[[self promisedTypesForPasteboard:pboard] copy] 
autorelease];
+    if (types) {
+        if ([self isProviderForPasteboard:pboard]) {
+            for (NSString *type in types) {
+                for (NSPasteboardItem *item in [pboard pasteboardItems]) {
+                    if ([[item types] containsObject:type]) {
+                        // can raise NSPasteboardCommunicationException
+                        @try { [item setData:[NSData data] forType:type]; }
+                        @catch(id exception) { NSLog(@"ignoring exception %@ 
in -[%@ %@]", exception, [self class], NSStringFromSelector(_cmd)); }
+                        break;
+                    }
                 }
             }
         }
+        [self removePromisedTypesForPasteboard:pboard];
     }
-    [self removePromisedTypesForPasteboard:pboard];
 }
 
 @end

Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m      2022-03-07 17:07:13 UTC (rev 
27279)
+++ trunk/bibdesk/BibDocument_DataSource.m      2022-03-07 17:38:45 UTC (rev 
27280)
@@ -464,6 +464,7 @@
 }
 
 - (void)clearPromisedDraggedItems{
+    [[NSPasteboard pasteboardWithName:NSDragPboard] clearContents];
        [pboardHelper clearPromisedTypesForPasteboard:[NSPasteboard 
pasteboardWithName:NSDragPboard]];
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to