Skip to content

Commit 507dfa2

Browse files
authored
Fix Storage usage of invalid pointers. (#1574)
* Move the usage of the const char* path into the original thread. * Add readme. * Add link to issue. * Add namespace to readme note.
1 parent e877b22 commit 507dfa2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

release_build_files/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,12 @@ workflow use only during the development of your app, not for publicly shipping
631631
code.
632632

633633
## Release Notes
634+
### Upcoming Release
635+
- Changes
636+
- Storage (iOS): Fix invalid pointer in `StorageReference::GetFile()` when
637+
running in a secondary thread
638+
([#1570](https://github.com/firebase/firebase-cpp-sdk/issues/1570)).
639+
634640
### 11.10.0
635641
- Changes
636642
- General (Android): Update to Firebase Android BoM version 32.8.1.

storage/src/ios/storage_reference_ios.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@
142142
// Cache a copy of the impl and storage, in case this is destroyed before the thread runs.
143143
FIRStorageReference* my_impl = impl();
144144
StorageInternal* storage = storage_;
145+
NSURL* local_file_url = [NSURL URLWithString:@(path)];
145146
util::DispatchAsyncSafeMainQueue(^() {
146147
FIRStorageDownloadTask *download_task;
147148
{
148149
MutexLock mutex(controller_init_mutex_);
149-
download_task = [my_impl writeToFile:[NSURL URLWithString:@(path)] completion:completion];
150+
download_task = [my_impl writeToFile:local_file_url completion:completion];
150151
local_controller->AssignTask(storage, download_task);
151152
}
152153
if (listener) {

0 commit comments

Comments
 (0)