From f2e86f400049b1441653864f8ffc672def4ce01e Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 14:49:57 +0000 Subject: [PATCH] copilot: Fix double lease panic when signing out (#46619) (cherry-pick to preview) (#46625) Cherry-pick of #46619 to preview ---- Extracted out of #46618 as I wanna fast-track it to Preview. Release Notes: - Fixed a crash that occured when signing out of Copilot. Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> --- crates/copilot/src/sign_in.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot/src/sign_in.rs index 4f71a34408e23f099d4d3c145d86af24e607e3c3..ed633fe9306abf9b060027e562909edd05dad8fb 100644 --- a/crates/copilot/src/sign_in.rs +++ b/crates/copilot/src/sign_in.rs @@ -89,10 +89,12 @@ fn copilot_toast(message: Option<&'static str>, window: &Window, cx: &mut App) { return; }; - workspace.update(cx, |workspace, cx| match message { - Some(message) => workspace.show_toast(Toast::new(NOTIFICATION_ID, message), cx), - None => workspace.dismiss_toast(&NOTIFICATION_ID, cx), - }); + cx.defer(move |cx| { + workspace.update(cx, |workspace, cx| match message { + Some(message) => workspace.show_toast(Toast::new(NOTIFICATION_ID, message), cx), + None => workspace.dismiss_toast(&NOTIFICATION_ID, cx), + }); + }) } pub fn initiate_sign_in_impl(is_reinstall: bool, window: &mut Window, cx: &mut App) {