Remove weak handle from EditorElement to Editor

This commit is contained in:
Antonio Scandurra 2023-04-14 14:29:03 +02:00
parent 060242a28a
commit a8e75a9b55
2 changed files with 266 additions and 324 deletions

View file

@ -6806,19 +6806,14 @@ impl View for Editor {
});
if font_changed {
let handle = self.handle.clone();
cx.defer(move |_, cx: &mut ViewContext<Editor>| {
if let Some(editor) = handle.upgrade(cx) {
editor.update(cx, |editor, cx| {
hide_hover(editor, &HideHover, cx);
hide_link_definition(editor, cx);
})
}
cx.defer(move |editor, cx: &mut ViewContext<Editor>| {
hide_hover(editor, &HideHover, cx);
hide_link_definition(editor, cx);
});
}
Stack::new()
.with_child(EditorElement::new(self.handle.clone(), style.clone()).boxed())
.with_child(EditorElement::new(style.clone()).boxed())
.with_child(ChildView::new(&self.mouse_context_menu, cx).boxed())
.boxed()
}