File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1+ # Unreleased
2+ - [ fixed] Fixed an intermittent crash if ` ListenerRegistration::Remove() ` was
3+ invoked concurrently (#10065 ).
4+
15# 9.4.0
26- [ fixed] Fixed a crash during app start (#9985 , #10018 ).
37
Original file line number Diff line number Diff line change 2222#include " Firestore/core/src/core/firestore_client.h"
2323#include " Firestore/core/src/core/query_listener.h"
2424#include " Firestore/core/src/core/view_snapshot.h"
25+ #include " absl/synchronization/mutex.h"
2526
2627namespace firebase {
2728namespace firestore {
@@ -38,6 +39,8 @@ QueryListenerRegistration::QueryListenerRegistration(
3839}
3940
4041void QueryListenerRegistration::Remove () {
42+ absl::MutexLock lock (&mutex_);
43+
4144 auto async_listener = async_listener_.lock ();
4245 if (async_listener) {
4346 async_listener->Mute ();
Original file line number Diff line number Diff line change 2121
2222#include " Firestore/core/src/api/listener_registration.h"
2323#include " Firestore/core/src/core/core_fwd.h"
24+ #include " absl/base/thread_annotations.h"
25+ #include " absl/synchronization/mutex.h"
2426
2527namespace firebase {
2628namespace firestore {
@@ -44,14 +46,17 @@ class QueryListenerRegistration : public ListenerRegistration {
4446 void Remove () override ;
4547
4648 private:
49+ absl::Mutex mutex_;
50+
4751 /* * The client that was used to register this listen. */
48- std::shared_ptr<core::FirestoreClient> client_;
52+ std::shared_ptr<core::FirestoreClient> client_ ABSL_GUARDED_BY (mutex_) ;
4953
5054 /* * The async listener that is used to mute events synchronously. */
51- std::weak_ptr<core::AsyncEventListener<core::ViewSnapshot>> async_listener_;
55+ std::weak_ptr<core::AsyncEventListener<core::ViewSnapshot>> async_listener_
56+ ABSL_GUARDED_BY (mutex_);
5257
5358 /* * The internal QueryListener that can be used to unlisten the query. */
54- std::weak_ptr<core::QueryListener> query_listener_;
59+ std::weak_ptr<core::QueryListener> query_listener_ ABSL_GUARDED_BY (mutex_) ;
5560};
5661
5762} // namespace api
You can’t perform that action at this time.
0 commit comments