Fix a theoretical concurrency issue by generating an index set directly instead of enumerating objects and filling an index set.
This commit is contained in:
parent
bb16b6b4e2
commit
a43f649935
|
@ -2416,10 +2416,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove empty groups
|
//remove empty groups
|
||||||
NSMutableIndexSet * removeIndexes = [NSMutableIndexSet indexSet];
|
NSIndexSet * removeIndexes = [fDisplayedTorrents indexesOfObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent passingTest: ^BOOL(id obj, NSUInteger idx, BOOL * stop) {
|
||||||
[fDisplayedTorrents enumerateObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent usingBlock: ^(id obj, NSUInteger idx, BOOL * stop) {
|
return [[(TorrentGroup *)obj torrents] count] == 0;
|
||||||
if ([[(TorrentGroup *)obj torrents] count] == 0)
|
|
||||||
[removeIndexes addIndex: idx];
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if ([removeIndexes count] > 0)
|
if ([removeIndexes count] > 0)
|
||||||
|
|
Loading…
Reference in New Issue