From 16bfd14b81e2fd3030b71c8cfd3f44f343f6b2b9 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 15 Sep 2023 14:35:03 +0200 Subject: [PATCH] !fixup --- .../matrix-sdk-ui/src/room_list_service/room_list.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-ui/src/room_list_service/room_list.rs b/crates/matrix-sdk-ui/src/room_list_service/room_list.rs index 2b1b22246..fd4919c6a 100644 --- a/crates/matrix-sdk-ui/src/room_list_service/room_list.rs +++ b/crates/matrix-sdk-ui/src/room_list_service/room_list.rs @@ -12,7 +12,10 @@ // See the License for that specific language governing permissions and // limitations under the License. -use std::{cell::RefCell, future::ready, sync::Arc}; +use std::{ + future::ready, + sync::{Arc, Mutex}, +}; use async_cell::sync::AsyncCell; use async_rx::StreamExt as _; @@ -203,7 +206,7 @@ pub struct RoomListDynamicEntriesController { filter: Arc>, page_size: usize, limit: SharedObservable, - maximum_number_of_rooms: RefCell>>, + maximum_number_of_rooms: Mutex>>, } impl RoomListDynamicEntriesController { @@ -217,7 +220,7 @@ impl RoomListDynamicEntriesController { filter, page_size, limit: limit_stream, - maximum_number_of_rooms: RefCell::new(maximum_number_of_rooms), + maximum_number_of_rooms: Mutex::new(maximum_number_of_rooms), } } @@ -243,7 +246,7 @@ impl RoomListDynamicEntriesController { /// Add one page, i.e. view `page_size` more entries in the room list if /// any. pub fn add_one_page(&self) { - if let Some(max) = self.maximum_number_of_rooms.borrow_mut().next_now() { + if let Some(max) = self.maximum_number_of_rooms.lock().unwrap().next_now() { let max: usize = max.try_into().unwrap(); let limit = self.limit.get();