Revision: 28994 http://sourceforge.net/p/bibdesk/svn/28994 Author: hofman Date: 2025-02-07 10:03:46 +0000 (Fri, 07 Feb 2025) Log Message: ----------- use returned pubs variable as markker that execution has finished
Modified Paths: -------------- trunk/bibdesk/BibDocument+Scripting.m Modified: trunk/bibdesk/BibDocument+Scripting.m =================================================================== --- trunk/bibdesk/BibDocument+Scripting.m 2025-02-06 17:32:50 UTC (rev 28993) +++ trunk/bibdesk/BibDocument+Scripting.m 2025-02-07 10:03:46 UTC (rev 28994) @@ -1111,7 +1111,6 @@ } } - __block BOOL finished = NO; __block BOOL suspended = NO; __block NSArray *returnPubs = nil; @@ -1135,19 +1134,18 @@ [mergeController mergeOverwriting]; } else { [mergeController beginSheetModalForWindow:documentWindow completionHandler:^(NSModalResponse rv){ - if (rv == NSModalResponseOK) - returnPubs = @[mergePub]; + returnPubs = rv == NSModalResponseOK ? @[mergePub] : @[]; if (suspended) - [command resumeExecutionWithResult:returnPubs ?: @[]]; - finished = YES; + [command resumeExecutionWithResult:returnPubs]; }]; return; } returnPubs = @[mergePub]; + } else { + returnPubs = @[]; } if (suspended) - [command resumeExecutionWithResult:returnPubs ?: @[]]; - finished = YES; + [command resumeExecutionWithResult:returnPubs]; }; } else { importPubs = ^(NSArray *result){ @@ -1163,10 +1161,9 @@ } [self importPublications:result publicationsToAutoFile:([url isFileURL] ? result : nil) options:BDSKImportAggregate | BDSKImportNoEdit]; } - returnPubs = result; + returnPubs = result ?: @[]; if (suspended) - [command resumeExecutionWithResult:result ?: @[]]; - finished = YES; + [command resumeExecutionWithResult:returnPubs]; }; } @@ -1191,13 +1188,13 @@ } else if (url) { importPubs(@[[BibItem itemWithURL:url title:nil owner:self]]); } else { - finished = YES; + returnPubs = @[]; } if (synchronous == NO) { return nil; - } else if (finished) { - return returnPubs ?: @[]; + } else if (returnPubs) { + return returnPubs; } else { [command suspendExecution]; suspended = YES; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit