Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Fix panic when resizing panel (#48772)
Finn Evers97835f9a5f65
diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex ba3b9943713..d5602b0d091 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -485,7 +485,7 @@ pub struct AgentPanel {}impl AgentPanel {- fn serialize(&mut self, cx: &mut Context<Self>) {+ fn serialize(&mut self, cx: &mut App) {let workspace_id = self.workspace.read_with(cx, |workspace, _| workspace.database_id())@@ -1894,7 +1894,14 @@ impl Panel for AgentPanel {DockPosition::Left | DockPosition::Right => self.width = size,DockPosition::Bottom => self.height = size,}- self.serialize(cx);+ let this = cx.weak_entity();+ cx.defer(move |cx| {+ if let Some(this) = this.upgrade() {+ this.update(cx, |this, cx| {+ this.serialize(cx);+ });+ }+ });cx.notify();}