diff --git a/VimR/VRFileItemOperation.mm b/VimR/VRFileItemOperation.mm index cb2516f89..1c91a6bb3 100644 --- a/VimR/VRFileItemOperation.mm +++ b/VimR/VRFileItemOperation.mm @@ -139,7 +139,7 @@ - (void)traverse { CANCEL_OR_WAIT() NSMutableArray *fileItemsToAdd = [[NSMutableArray alloc] initWithCapacity:childrenOfCurrentItem.count]; - BOOL enumerationComplete = + BOOL operationCancelled = [self chunkEnumerateArray:childrenOfCurrentItem usingBlockOnChunks:^(size_t beginIndex, size_t endIndex) { for (size_t i = beginIndex; i <= endIndex; i++) { VRFileItem *item = childrenOfCurrentItem[i]; @@ -151,7 +151,7 @@ - (void)traverse { } }]; - if (!enumerationComplete) { + if (!operationCancelled) { return; } @@ -189,7 +189,7 @@ - (void)cacheDirectDescendants:(__weak VRFileItem *)item { } } -- (BOOL)addAllToUrlsForTargetUrl:(NSArray *)items { +- (BOOL)addAllToUrlsForTargetUrl:(__weak NSArray *)items { __block BOOL added = NO; BOOL enumerationComplete = [self chunkEnumerateArray:items usingBlockOnChunks:^(size_t beginIndex, size_t endIndex) { @@ -221,7 +221,7 @@ - (BOOL)addAllToUrlsForTargetUrl:(NSArray *)items { * shouldStopBeforeChunk() is called before each chunk execution and if it returns YES, we stop and return NO, ie * the enumeration was not complete, but was cancelled. */ -- (BOOL)chunkEnumerateArray:(NSArray *)array +- (BOOL)chunkEnumerateArray:(__weak NSArray *)array usingBlockOnChunks:(void (^)(size_t beginIndex, size_t endIndex))blockOnChunks { std::vector> chunkedIndexes = chunked_indexes(array.count, qArrayChunkSize);