From 0f21a6dcd66ce5163f163721f3809a28eb876173 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sun, 24 Jan 2021 17:43:23 +0100 Subject: [PATCH] VecSequence: fix reset update length in reset --- src/sequence/vec_buffer.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sequence/vec_buffer.rs b/src/sequence/vec_buffer.rs index f2e32ca..b465454 100644 --- a/src/sequence/vec_buffer.rs +++ b/src/sequence/vec_buffer.rs @@ -64,7 +64,16 @@ where T: Clone + Send + Sync + 'static { fn reset(&mut self, view: Option>>>) { let old_len = self.len().unwrap(); self.data = view; + + *self.cur_len.write().unwrap() = + if let Some(data) = self.data.as_ref() { + data.read().unwrap().len() + } else { + 0 + }; + let new_len = self.len().unwrap(); + self.cast.notify_each(0 .. std::cmp::max(old_len, new_len)); }