From 12a286ac509830333975d7e70e47c923abfbb2c8 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 12 Apr 2023 09:30:34 +0200 Subject: [PATCH] Forget buffered operations when resyncing with the host Previously, we could end up with a situation where the host did not see an operation but a guest that didn't have that buffer open would. When such guest would finally open the buffer, they would apply the operation without however sending it to the host. The guest wouldn't bother resyncing it because it wasn't part of its open buffers. --- crates/project/src/project.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 90985f881040512110759fa9647ad80205a6089b..9192c7a411de149b7d7daa715ccd4eb00cb73f70 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -4725,6 +4725,8 @@ impl Project { } if is_host { + this.opened_buffers + .retain(|_, buffer| !matches!(buffer, OpenBuffer::Operations(_))); this.buffer_changes_tx .unbounded_send(BufferMessage::Resync) .unwrap();