mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
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
1 changed files with 2 additions and 4 deletions
|
@ -2416,10 +2416,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
}
|
||||
|
||||
//remove empty groups
|
||||
NSMutableIndexSet * removeIndexes = [NSMutableIndexSet indexSet];
|
||||
[fDisplayedTorrents enumerateObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent usingBlock: ^(id obj, NSUInteger idx, BOOL * stop) {
|
||||
if ([[(TorrentGroup *)obj torrents] count] == 0)
|
||||
[removeIndexes addIndex: idx];
|
||||
NSIndexSet * removeIndexes = [fDisplayedTorrents indexesOfObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, originalGroupCount)] options: NSEnumerationConcurrent passingTest: ^BOOL(id obj, NSUInteger idx, BOOL * stop) {
|
||||
return [[(TorrentGroup *)obj torrents] count] == 0;
|
||||
}];
|
||||
|
||||
if ([removeIndexes count] > 0)
|
||||
|
|
Loading…
Reference in a new issue