Use AppContext instead of AsyncWindowContext to quit

Fixes refcell-related panic
This commit is contained in:
Piotr Osiewicz 2023-11-27 15:44:19 +01:00
parent a71180257d
commit 44876062c9
3 changed files with 13 additions and 6 deletions

View file

@ -609,12 +609,12 @@ impl CallHandler for Call {
fn room_id(&self, cx: &AppContext) -> Option<u64> {
Some(self.active_call.as_ref()?.0.read(cx).room()?.read(cx).id())
}
fn hang_up(&self, mut cx: AsyncWindowContext) -> Result<Task<Result<()>>> {
fn hang_up(&self, mut cx: &mut AppContext) -> Task<Result<()>> {
let Some((call, _)) = self.active_call.as_ref() else {
bail!("Cannot exit a call; not in a call");
return Task::ready(Err(anyhow!("Cannot exit a call; not in a call")));
};
call.update(&mut cx, |this, cx| this.hang_up(cx))
call.update(cx, |this, cx| this.hang_up(cx))
}
fn active_project(&self, cx: &AppContext) -> Option<WeakModel<Project>> {
ActiveCall::global(cx).read(cx).location().cloned()