Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix group can add operations and set completion multiple times when the group start. #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## master
* Add your own contributions to the next release on the line below this with your name.

- [fix] Fix group can add operations and set completion multiple times when the group start. [#22](https://github.com/pinterest/PINOperation/pull/22)

## 1.1.1 -- 2018 February 3
* Cleanup warnings [garrett](https://github.com/garrettmoon)

Expand Down
2 changes: 2 additions & 0 deletions Source/PINOperationGroup.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ - (void)start
[self lock];
NSAssert(_canceled == NO, @"Operation group canceled.");
if (_started == NO && _canceled == NO) {
_started = YES;
for (NSUInteger idx = 0; idx < _operations.count; idx++) {
dispatch_group_enter(_group);
dispatch_block_t originalOperation = _operations[idx];
Expand Down Expand Up @@ -167,6 +168,7 @@ - (void)runCompletionIfNeeded
[self lock];
completion = _completion;
_completion = nil;
_started = NO;
[self unlock];

if (completion) {
Expand Down