Skip to content

Commit

Permalink
Fix Storage usage of invalid pointers. (#1574)
Browse files Browse the repository at this point in the history
* Move the usage of the const char* path into the original thread.

* Add readme.

* Add link to issue.

* Add namespace to readme note.
  • Loading branch information
jonsimantov authored Apr 23, 2024
1 parent e877b22 commit 507dfa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,12 @@ workflow use only during the development of your app, not for publicly shipping
code.

## Release Notes
### Upcoming Release
- Changes
- Storage (iOS): Fix invalid pointer in `StorageReference::GetFile()` when
running in a secondary thread
([#1570](https://github.com/firebase/firebase-cpp-sdk/issues/1570)).

### 11.10.0
- Changes
- General (Android): Update to Firebase Android BoM version 32.8.1.
Expand Down
3 changes: 2 additions & 1 deletion storage/src/ios/storage_reference_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@
// Cache a copy of the impl and storage, in case this is destroyed before the thread runs.
FIRStorageReference* my_impl = impl();
StorageInternal* storage = storage_;
NSURL* local_file_url = [NSURL URLWithString:@(path)];
util::DispatchAsyncSafeMainQueue(^() {
FIRStorageDownloadTask *download_task;
{
MutexLock mutex(controller_init_mutex_);
download_task = [my_impl writeToFile:[NSURL URLWithString:@(path)] completion:completion];
download_task = [my_impl writeToFile:local_file_url completion:completion];
local_controller->AssignTask(storage, download_task);
}
if (listener) {
Expand Down

0 comments on commit 507dfa2

Please sign in to comment.