Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix circular reference issue between EditPredictionButton and PopoverMenuHandle (#42351)

feeiyu42ed032f129f
diff --git a/crates/edit_prediction_button/src/edit_prediction_button.rs b/crates/edit_prediction_button/src/edit_prediction_button.rs
index 70c861ab111..6e9000bc62e 100644
--- a/crates/edit_prediction_button/src/edit_prediction_button.rs
+++ b/crates/edit_prediction_button/src/edit_prediction_button.rs
@@ -379,11 +379,12 @@ impl Render for EditPredictionButton {
})
});
- let this = cx.entity();
+ let this = cx.weak_entity();
let mut popover_menu = PopoverMenu::new("zeta")
.menu(move |window, cx| {
- Some(this.update(cx, |this, cx| this.build_zeta_context_menu(window, cx)))
+ this.update(cx, |this, cx| this.build_zeta_context_menu(window, cx))
+ .ok()
})
.anchor(Corner::BottomRight)
.with_handle(self.popover_menu_handle.clone());