Ensure project is still alive by the time remote LSP request starts
This commit is contained in:
parent
5898600239
commit
5e37c893c2
1 changed files with 6 additions and 0 deletions
|
@ -4210,7 +4210,13 @@ impl Project {
|
||||||
let rpc = self.client.clone();
|
let rpc = self.client.clone();
|
||||||
let message = request.to_proto(project_id, buffer);
|
let message = request.to_proto(project_id, buffer);
|
||||||
return cx.spawn_weak(|this, cx| async move {
|
return cx.spawn_weak(|this, cx| async move {
|
||||||
|
// Ensure the project is still alive by the time the task
|
||||||
|
// is scheduled.
|
||||||
|
this.upgrade(&cx)
|
||||||
|
.ok_or_else(|| anyhow!("project dropped"))?;
|
||||||
|
|
||||||
let response = rpc.request(message).await?;
|
let response = rpc.request(message).await?;
|
||||||
|
|
||||||
let this = this
|
let this = this
|
||||||
.upgrade(&cx)
|
.upgrade(&cx)
|
||||||
.ok_or_else(|| anyhow!("project dropped"))?;
|
.ok_or_else(|| anyhow!("project dropped"))?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue