Allow direct read/update of WeakViewHandle only in AsyncAppContext

This commit is contained in:
Antonio Scandurra
2023-04-26 12:20:57 +02:00
parent 2b6830c798
commit 57beec6071
3 changed files with 13 additions and 12 deletions
+5 -4
View File
@@ -201,10 +201,11 @@ impl ToolbarItemView for BufferSearchBar {
Some(searchable_item_handle.subscribe_to_search_events(
cx,
Box::new(move |search_event, cx| {
this.update(cx, |this, cx| {
this.on_active_searchable_item_event(search_event, cx)
})
.log_err();
if let Some(this) = this.upgrade(cx) {
this.update(cx, |this, cx| {
this.on_active_searchable_item_event(search_event, cx)
});
}
}),
));