Fix race condition when opening a buffer and getting a definition to it

This commit is contained in:
Antonio Scandurra 2022-01-24 18:47:41 +01:00
parent 93125cbd16
commit 96b66dcce1
7 changed files with 160 additions and 135 deletions

View file

@ -305,7 +305,7 @@ impl Buffer {
pub fn from_proto(
replica_id: ReplicaId,
message: proto::Buffer,
message: proto::BufferState,
file: Option<Box<dyn File>>,
cx: &mut ModelContext<Self>,
) -> Result<Self> {
@ -359,8 +359,8 @@ impl Buffer {
Ok(this)
}
pub fn to_proto(&self) -> proto::Buffer {
proto::Buffer {
pub fn to_proto(&self) -> proto::BufferState {
proto::BufferState {
id: self.remote_id(),
file: self.file.as_ref().map(|f| f.to_proto()),
visible_text: self.text.text(),

View file

@ -7,7 +7,7 @@ use rpc::proto;
use std::sync::Arc;
use text::*;
pub use proto::{Buffer, SelectionSet};
pub use proto::{Buffer, BufferState, SelectionSet};
pub fn serialize_operation(operation: &Operation) -> proto::Operation {
proto::Operation {