From dc786703d1cbbec57305130ac2ef710fdabceea4 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Tue, 17 Feb 2026 17:49:45 -0800 Subject: [PATCH 1/4] Change Firestore credentials to use shared_ptr --- .../src/util/integration_test_util.cc | 4 ++-- .../src/main/create_app_check_credentials_provider.h | 2 +- .../main/create_app_check_credentials_provider_desktop.cc | 4 ++-- .../src/main/create_app_check_credentials_provider_ios.mm | 7 ++++--- firestore/src/main/create_credentials_provider.h | 2 +- firestore/src/main/create_credentials_provider_desktop.cc | 4 ++-- firestore/src/main/create_credentials_provider_ios.mm | 4 ++-- firestore/src/main/firestore_main.cc | 8 ++++---- firestore/src/main/firestore_main.h | 8 ++++---- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/firestore/integration_test_internal/src/util/integration_test_util.cc b/firestore/integration_test_internal/src/util/integration_test_util.cc index d3a4129ed5..dae0c7af90 100644 --- a/firestore/integration_test_internal/src/util/integration_test_util.cc +++ b/firestore/integration_test_internal/src/util/integration_test_util.cc @@ -39,8 +39,8 @@ struct TestFriend { #if !defined(__ANDROID__) return new FirestoreInternal( app, database_id, - absl::make_unique(), - absl::make_unique()); + absl::make_shared(), + absl::make_shared()); #else return new FirestoreInternal(app, database_id); #endif // !defined(__ANDROID__) diff --git a/firestore/src/main/create_app_check_credentials_provider.h b/firestore/src/main/create_app_check_credentials_provider.h index 50e515dfe5..e7c088d8d5 100644 --- a/firestore/src/main/create_app_check_credentials_provider.h +++ b/firestore/src/main/create_app_check_credentials_provider.h @@ -31,7 +31,7 @@ class App; namespace firestore { -std::unique_ptr +std::shared_ptr CreateAppCheckCredentialsProvider(App& app); } // namespace firestore diff --git a/firestore/src/main/create_app_check_credentials_provider_desktop.cc b/firestore/src/main/create_app_check_credentials_provider_desktop.cc index 6225ffe142..91f89ae17b 100644 --- a/firestore/src/main/create_app_check_credentials_provider_desktop.cc +++ b/firestore/src/main/create_app_check_credentials_provider_desktop.cc @@ -23,9 +23,9 @@ namespace firestore { using credentials::AppCheckCredentialsProvider; -std::unique_ptr CreateAppCheckCredentialsProvider( +std::shared_ptr CreateAppCheckCredentialsProvider( App& app) { - return absl::make_unique(app); + return absl::make_shared(app); } } // namespace firestore diff --git a/firestore/src/main/create_app_check_credentials_provider_ios.mm b/firestore/src/main/create_app_check_credentials_provider_ios.mm index dfc6d8d6fe..b3e71d8325 100644 --- a/firestore/src/main/create_app_check_credentials_provider_ios.mm +++ b/firestore/src/main/create_app_check_credentials_provider_ios.mm @@ -16,6 +16,8 @@ #include "firestore/src/main/create_credentials_provider.h" +#include + #import "FIRAppInternal.h" #import "FIRComponent.h" #import "FIRComponentContainer.h" @@ -24,7 +26,6 @@ #import "FirebaseCore.h" #include "Firestore/core/src/credentials/firebase_app_check_credentials_provider_apple.h" -#include "absl/memory/memory.h" #include "app/src/include/firebase/app.h" namespace firebase { @@ -33,11 +34,11 @@ using credentials::AppCheckCredentialsProvider; using credentials::FirebaseAppCheckCredentialsProvider; -std::unique_ptr CreateAppCheckCredentialsProvider( +std::shared_ptr CreateAppCheckCredentialsProvider( App& app) { FIRApp* ios_app = app.GetPlatformApp(); auto ios_app_check = FIR_COMPONENT(FIRAppCheckInterop, ios_app.container); - return absl::make_unique(ios_app, + return std::make_shared(ios_app, ios_app_check); } diff --git a/firestore/src/main/create_credentials_provider.h b/firestore/src/main/create_credentials_provider.h index eb6837cf22..5edc5b8f74 100644 --- a/firestore/src/main/create_credentials_provider.h +++ b/firestore/src/main/create_credentials_provider.h @@ -31,7 +31,7 @@ class App; namespace firestore { -std::unique_ptr CreateCredentialsProvider( +std::shared_ptr CreateCredentialsProvider( App& app); } // namespace firestore diff --git a/firestore/src/main/create_credentials_provider_desktop.cc b/firestore/src/main/create_credentials_provider_desktop.cc index fac9e68afb..5232e19e39 100644 --- a/firestore/src/main/create_credentials_provider_desktop.cc +++ b/firestore/src/main/create_credentials_provider_desktop.cc @@ -26,8 +26,8 @@ namespace firestore { using credentials::AuthCredentialsProvider; using firebase::auth::Auth; -std::unique_ptr CreateCredentialsProvider(App& app) { - return std::make_unique(app); +std::shared_ptr CreateCredentialsProvider(App& app) { + return std::make_shared(app); } } // namespace firestore diff --git a/firestore/src/main/create_credentials_provider_ios.mm b/firestore/src/main/create_credentials_provider_ios.mm index a6999a3b69..57eb74441c 100644 --- a/firestore/src/main/create_credentials_provider_ios.mm +++ b/firestore/src/main/create_credentials_provider_ios.mm @@ -34,10 +34,10 @@ using credentials::AuthCredentialsProvider; using credentials::FirebaseAuthCredentialsProvider; -std::unique_ptr CreateCredentialsProvider(App& app) { +std::shared_ptr CreateCredentialsProvider(App& app) { FIRApp* ios_app = app.GetPlatformApp(); auto ios_auth = FIR_COMPONENT(FIRAuthInterop, ios_app.container); - return std::make_unique(ios_app, ios_auth); + return std::make_shared(ios_app, ios_auth); } } // namespace firestore diff --git a/firestore/src/main/firestore_main.cc b/firestore/src/main/firestore_main.cc index 8a512a49e5..927c1ac2c7 100644 --- a/firestore/src/main/firestore_main.cc +++ b/firestore/src/main/firestore_main.cc @@ -109,8 +109,8 @@ FirestoreInternal::FirestoreInternal(App* app, const std::string& database_id) FirestoreInternal::FirestoreInternal( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr app_check_credentials) + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials) : app_(NOT_NULL(app)), firestore_core_(CreateFirestore(app, database_id, @@ -137,8 +137,8 @@ FirestoreInternal::~FirestoreInternal() { std::shared_ptr FirestoreInternal::CreateFirestore( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr app_check_credentials) { + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials) { const AppOptions& opt = app->options(); return std::make_shared( DatabaseId{opt.project_id(), database_id}, app->name(), diff --git a/firestore/src/main/firestore_main.h b/firestore/src/main/firestore_main.h index 7920eccc4f..ee423298f7 100644 --- a/firestore/src/main/firestore_main.h +++ b/firestore/src/main/firestore_main.h @@ -154,15 +154,15 @@ class FirestoreInternal { FirestoreInternal( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials); std::shared_ptr CreateFirestore( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials); // Gets the reference-counted Future implementation of this instance, which From fd1518e29bcef1f094bd981605aa30228f0804fb Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 18 Feb 2026 10:59:38 -0800 Subject: [PATCH 2/4] Fix absl references --- .../src/util/integration_test_util.cc | 4 ++-- .../main/create_app_check_credentials_provider_desktop.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/firestore/integration_test_internal/src/util/integration_test_util.cc b/firestore/integration_test_internal/src/util/integration_test_util.cc index dae0c7af90..281593703e 100644 --- a/firestore/integration_test_internal/src/util/integration_test_util.cc +++ b/firestore/integration_test_internal/src/util/integration_test_util.cc @@ -39,8 +39,8 @@ struct TestFriend { #if !defined(__ANDROID__) return new FirestoreInternal( app, database_id, - absl::make_shared(), - absl::make_shared()); + std::make_shared(), + std::make_shared()); #else return new FirestoreInternal(app, database_id); #endif // !defined(__ANDROID__) diff --git a/firestore/src/main/create_app_check_credentials_provider_desktop.cc b/firestore/src/main/create_app_check_credentials_provider_desktop.cc index 91f89ae17b..ddb7c0152d 100644 --- a/firestore/src/main/create_app_check_credentials_provider_desktop.cc +++ b/firestore/src/main/create_app_check_credentials_provider_desktop.cc @@ -14,7 +14,8 @@ * limitations under the License. */ -#include "absl/memory/memory.h" +#include + #include "firestore/src/main/app_check_credentials_provider_desktop.h" #include "firestore/src/main/create_credentials_provider.h" @@ -25,7 +26,7 @@ using credentials::AppCheckCredentialsProvider; std::shared_ptr CreateAppCheckCredentialsProvider( App& app) { - return absl::make_shared(app); + return std::make_shared(app); } } // namespace firestore From 5e2bcb5015b8ffde4f7ccdec8b85364da4ecac2f Mon Sep 17 00:00:00 2001 From: a-maurice Date: Wed, 18 Feb 2026 11:00:17 -0800 Subject: [PATCH 3/4] Update create_app_check_credentials_provider_ios.mm --- firestore/src/main/create_app_check_credentials_provider_ios.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firestore/src/main/create_app_check_credentials_provider_ios.mm b/firestore/src/main/create_app_check_credentials_provider_ios.mm index b3e71d8325..60368f96cf 100644 --- a/firestore/src/main/create_app_check_credentials_provider_ios.mm +++ b/firestore/src/main/create_app_check_credentials_provider_ios.mm @@ -39,7 +39,7 @@ FIRApp* ios_app = app.GetPlatformApp(); auto ios_app_check = FIR_COMPONENT(FIRAppCheckInterop, ios_app.container); return std::make_shared(ios_app, - ios_app_check); + ios_app_check); } } // namespace firestore From c0c64ba36a756ab369866a8277142af2f1612fb2 Mon Sep 17 00:00:00 2001 From: a-maurice Date: Thu, 19 Feb 2026 18:38:49 -0800 Subject: [PATCH 4/4] Update readme.md --- release_build_files/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/release_build_files/readme.md b/release_build_files/readme.md index bebceabca9..c5e8fec34c 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -616,6 +616,7 @@ code. ### Upcoming - Changes - App Check: Add in support for Limited Use Tokens. + - Firestore (iOS): Fix crash when using Auth or App Check Credentials. ### 13.4.0 - Changes