Revision: 27277
          http://sourceforge.net/p/bibdesk/svn/27277
Author:   hofman
Date:     2022-03-07 16:08:09 +0000 (Mon, 07 Mar 2022)
Log Message:
-----------
Remove archived pubs or intermediate strings for promised items before setting 
the provided data, as this could invalidate the info

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

Modified: trunk/bibdesk/BDSKItemPasteboardHelper.m
===================================================================
--- trunk/bibdesk/BDSKItemPasteboardHelper.m    2022-03-07 15:45:42 UTC (rev 
27276)
+++ trunk/bibdesk/BDSKItemPasteboardHelper.m    2022-03-07 16:08:09 UTC (rev 
27277)
@@ -176,7 +176,12 @@
     NSArray *items = [dict objectForKey:@"items"];
     
     if ([type isEqualToString:BDSKPasteboardTypePublications]) {
-        data = items ? [BibItem archivedPublications:items] : [dict 
objectForKey:@"archivedData"];
+        if (items) {
+            data = [BibItem archivedPublications:items];
+        } else {
+            data = [[[dict objectForKey:@"archivedData"] retain] autorelease];
+            [dict removeObjectForKey:@"archivedData"];
+        }
     } else {
         NSString *bibString = nil;
         NSArray *citeKeys = nil;
@@ -185,8 +190,10 @@
             bibString = [delegate pasteboardHelper:self 
bibTeXStringForItems:items];
             citeKeys = [items valueForKey:@"citeKey"];
         } else {
-            bibString = [dict objectForKey:@"bibTeXString"];
-            citeKeys = [dict objectForKey:@"citeKeys"];
+            bibString = [[[dict objectForKey:@"bibTeXString"] retain] 
autorelease];
+            citeKeys = [[[dict objectForKey:@"citeKeys"] retain] autorelease];
+            [dict removeObjectForKey:@"bibTeXString"];
+            [dict removeObjectForKey:@"citeKeys"];
         }
         if (bibString != nil) {
             BDSKDragCopyType dragCopyType = [[dict 
objectForKey:@"dragCopyType"] integerValue];
@@ -247,8 +254,6 @@
         [item setString:string forType:type];
     } else if (data) {
         [item setData:data forType:type];
-        if ([type isEqualToString:BDSKPasteboardTypePublications])
-            [dict removeObjectForKey:@"archivedData"];
     } else {
         [item setData:[NSData data] forType:type];
         NSBeep();

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