Revision: 28768
          http://sourceforge.net/p/bibdesk/svn/28768
Author:   hofman
Date:     2024-02-18 15:49:15 +0000 (Sun, 18 Feb 2024)
Log Message:
-----------
separrate method to terminate tex tasks

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

Modified: trunk/bibdesk/BDSKItemPasteboardHelper.m
===================================================================
--- trunk/bibdesk/BDSKItemPasteboardHelper.m    2024-02-18 15:20:35 UTC (rev 
28767)
+++ trunk/bibdesk/BDSKItemPasteboardHelper.m    2024-02-18 15:49:15 UTC (rev 
28768)
@@ -58,6 +58,7 @@
 - (void)removePromisedType:(NSString *)type forPasteboard:(NSPasteboard 
*)pboard;
 - (void)removePromisedTypesForPasteboard:(NSPasteboard *)pboard;
 - (void)startTeXTaskForPasteboard:(NSPasteboard *)pboard;
+- (void)terminateTeXTasks;
 
 @end
 
@@ -67,9 +68,7 @@
 
 - (void)dealloc {
     // we should have already cleared everything in the final call to 
removePromisedTypesForPasteboard:
-    [[texTasks allValues] makeObjectsPerformSelector:@selector(terminate)];
-    if (texTask && [[texTasks allValues] containsObject:texTask] == NO)
-        [texTask terminate];
+    [self terminateTeXTasks];
 }
 
 - (void)setDelegate:(id<BDSKItemPasteboardHelperDelegate>)newDelegate {
@@ -99,10 +98,8 @@
             }];
         }
         delegate = newDelegate;
-        if (delegate == nil && promisedPboardTypes == nil && texTask) {
-            [texTask terminate];
-            texTask = nil;
-        }
+        if (delegate == nil && promisedPboardTypes == nil)
+            [self terminateTeXTasks];
     }
 }
 
@@ -321,10 +318,8 @@
         }
         [promisedPboardTypes removeObjectForKey:pbName];
         if ([promisedPboardTypes count] == 0 && promisedPboardTypes != nil) {
-            if (delegate == nil && texTask) {
-                [texTask terminate];
-                texTask = nil;
-            }
+            if (delegate == nil)
+                [self terminateTeXTasks];
             promisedPboardTypes = nil;
             // we used promisedPboardTypes != nil to signal we retained 
ourselves
             // see setPromisedTypes:items:dragCopyType:forPasteboard:
@@ -371,6 +366,14 @@
     [currentTask runWithBibTeXString:bibString citeKeys:citeKeys 
generatedType:generatedType];
 }
 
+- (void)terminateTeXTasks {
+    [[texTasks allValues] makeObjectsPerformSelector:@selector(terminate)];
+    if (texTask && [[texTasks allValues] containsObject:texTask] == NO)
+        [texTask terminate];
+    texTasks = nil;
+    texTask = nil;
+}
+
 - (void)texTask:(BDSKTeXTask *)aTexTask finishedWithResult:(BOOL)success {
     NSString *pbName = [[texTasks allKeysForObject:aTexTask] firstObject];
     if (pbName) {

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