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(),