Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git_ui: Fix double borrow when showing worktree error message (#54555)
Bennet Bo Fennera658e1d3b0e2
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rsindex 23d9c728c05..8f66350a306 100644--- a/crates/git_ui/src/git_panel.rs+++ b/crates/git_ui/src/git_panel.rs@@ -6572,25 +6572,27 @@ pub(crate) fn show_error_toast(.is_some(){ // Hide the cancelled by user message} else {- workspace.update(cx, |workspace, cx| {- let workspace_weak = cx.weak_entity();- let toast = StatusToast::new(format!("git {} failed", action), cx, |this, _cx| {- this.icon(- Icon::new(IconName::XCircle)- .size(IconSize::Small)- .color(Color::Error),- )- .action("View Log", move |window, cx| {- let message = message.clone();- let action = action.clone();- workspace_weak- .update(cx, move |workspace, cx| {- open_output(action, workspace, &message, window, cx)- })- .ok();- })+ cx.defer(move |cx| {+ workspace.update(cx, |workspace, cx| {+ let workspace_weak = cx.weak_entity();+ let toast = StatusToast::new(format!("git {} failed", action), cx, |this, _cx| {+ this.icon(+ Icon::new(IconName::XCircle)+ .size(IconSize::Small)+ .color(Color::Error),+ )+ .action("View Log", move |window, cx| {+ let message = message.clone();+ let action = action.clone();+ workspace_weak+ .update(cx, move |workspace, cx| {+ open_output(action, workspace, &message, window, cx)+ })+ .ok();+ })+ });+ workspace.toggle_status_toast(toast, cx)});- workspace.toggle_status_toast(toast, cx)});}}