Revision: 28237
          http://sourceforge.net/p/bibdesk/svn/28237
Author:   hofman
Date:     2023-04-21 13:46:16 +0000 (Fri, 21 Apr 2023)
Log Message:
-----------
check whether pboard was reset when waiting for tex task

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

Modified: trunk/bibdesk/BDSKItemPasteboardHelper.m
===================================================================
--- trunk/bibdesk/BDSKItemPasteboardHelper.m    2023-04-20 22:18:32 UTC (rev 
28236)
+++ trunk/bibdesk/BDSKItemPasteboardHelper.m    2023-04-21 13:46:16 UTC (rev 
28237)
@@ -163,7 +163,7 @@
     NSData *data = nil;
     NSString *string = nil;
     NSString *pbName = [pboard name];
-    NSMutableDictionary *dict = [self pasteboardIsValid:pboard] ? 
[promisedPboardTypes objectForKey:pbName] : nil;
+    NSMutableDictionary *dict = [self pasteboardIsValid:pboard] ? 
[[promisedPboardTypes objectForKey:pbName] retain] : nil;
     NSArray *items = [dict objectForKey:ITEMS_KEY];
     
     if ([type isEqualToString:BDSKPasteboardTypePublications]) {
@@ -172,7 +172,7 @@
         } else {
             data = [dict objectForKey:ARCHIVEDDATA_KEY];
         }
-    } else {
+    } else if (dict) {
         id result = [dict objectForKey:TEXTASKRESULT_KEY];
         
         if (result == nil) {
@@ -183,7 +183,7 @@
                 [delegate pasteboardHelperWillBeginGenerating:self];
             
             NSDate *start = [[NSDate alloc] init];
-            while ([texTasks objectForKey:pbName]) {
+            while ([texTasks objectForKey:pbName] && [promisedPboardTypes 
objectForKey:pbName] == dict) {
                 NSDate *next = [[NSDate alloc] 
initWithTimeIntervalSinceNow:0.1];
                 if ([next timeIntervalSinceDate:start] > 60.0) {
                     [next release];
@@ -194,8 +194,6 @@
             }
             [start release];
             
-            // dict may become invalid in the meantime, so get it again
-            dict = [self pasteboardIsValid:pboard] ? [promisedPboardTypes 
objectForKey:pbName] : nil;
             result = [dict objectForKey:TEXTASKRESULT_KEY];
             
             if (--generatorCount == 0 && [delegate 
respondsToSelector:@selector(pasteboardHelperDidEndGenerating:)])
@@ -208,6 +206,8 @@
             data = result;
     }
     
+    [dict release];
+    
     if (string) {
         [item setString:string forType:type];
     } else if (data) {

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