Use handles to obtain entities in future callbacks

This guarantees that the spawning entity will be present and simplifies
the logic for obtaining the entity. Now we can forward the results of spawned futures and streams in the same way regardless of whether what spawned them was a model or a view.
This commit is contained in:
Nathan Sobo
2021-04-05 20:04:04 -06:00
parent fda1394057
commit 2970e934da
3 changed files with 83 additions and 240 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ impl BufferView {
let buffer_ref = buffer.as_ref(ctx);
Self {
handle: ctx.handle(),
handle: ctx.handle().downgrade(),
buffer,
display_map,
selections: vec![Selection {
+1 -1
View File
@@ -275,7 +275,7 @@ impl FileFinder {
settings.notify_view_on_change(ctx);
Self {
handle: ctx.handle(),
handle: ctx.handle().downgrade(),
settings,
workspace,
query_buffer,