From d00cfb0ba892ecb62c4c5b6907b849ebf9cfdc9d Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Tue, 23 Sep 2025 15:28:06 +0200 Subject: [PATCH] fix(base): Take the state store lock before updating it. This patch updates `BaseClient::receive_sync_response_with_requested_required_states` to take the state store lock before applying any change onto it. --- crates/matrix-sdk-base/src/client.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index 1dc3724db..34a1adfa9 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -806,7 +806,11 @@ impl BaseClient { .await; // Save the new display name updates if any. - processors::changes::save_only(context, &self.state_store).await?; + { + let _sync_lock = self.sync_lock().lock().await; + + processors::changes::save_only(context, &self.state_store).await?; + } for (room_id, member_ids) in updated_members_in_room { if let Some(room) = self.get_room(&room_id) {