Skip to content

Commit

Permalink
Fix SIGSEGV in callback after block is nil'd (#3786)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Sep 6, 2019
1 parent dfa4113 commit d440418
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Firebase/Storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 3.4.1
- [fixed] Fix crash in FIRStorageUploadTask (#3750).

# 3.4.0
- [fixed] Ensure that users don't accidently invoke `Storage()` instead of `Storage.storage()`.
If your code calls the constructor of Storage directly, we will throw an assertion failure,
Expand Down
7 changes: 3 additions & 4 deletions Firebase/Storage/FIRStorageUploadTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ - (void)enqueue {
// Process fetches
strongSelf.state = FIRStorageTaskStateRunning;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-retain-cycles"
strongSelf->_fetcherCompletion = ^(NSData *_Nullable data, NSError *_Nullable error) {
// Fire last progress updates
[self fireHandlersForStatus:FIRStorageTaskStatusProgress snapshot:self.snapshot];
Expand Down Expand Up @@ -172,11 +170,12 @@ - (void)enqueue {

[self finishTaskWithStatus:FIRStorageTaskStatusSuccess snapshot:self.snapshot];
};
#pragma clang diagnostic pop

[strongSelf->_uploadFetcher
beginFetchWithCompletionHandler:^(NSData *_Nullable data, NSError *_Nullable error) {
weakSelf.fetcherCompletion(data, error);
if (weakSelf.fetcherCompletion != nil) {
weakSelf.fetcherCompletion(data, error);
}
}];
}];
}
Expand Down

0 comments on commit d440418

Please sign in to comment.