Copy and nil block queue before executing #trivial

Summary:
Discovered in rnystrom/GitHawk#781 and introduced in d9a89c9b00. Can't repro in unit test, but have obvious stack traces (see GitHawk issue) that collection is being mutated while enumerated.

No changelog since this is a new fix for 3.2.
Closes https://github.com/Instagram/IGListKit/pull/995

Reviewed By: manicakes

Differential Revision: D6206957

Pulled By: rnystrom

fbshipit-source-id: c42e3688d0f2b31693199f8015b5de48b7b3b9e6
This commit is contained in:
Ryan Nystrom 2017-11-03 11:24:29 -07:00 committed by Facebook Github Bot
parent a6f264fc12
commit 8cffc50d7d

View file

@ -749,10 +749,11 @@
}
- (void)exitBatchUpdates {
for (void (^block)(void) in _queuedCompletionBlocks) {
NSArray *blocks = [_queuedCompletionBlocks copy];
_queuedCompletionBlocks = nil;
for (void (^block)(void) in blocks) {
block();
}
_queuedCompletionBlocks = nil;
}
#pragma mark - UIScrollViewDelegate