fix leak tasks

This commit is contained in:
2026-09-27 09:24:41 +07:00
parent 0ee67d93b6
commit 8ea320cd6f
4 changed files with 33 additions and 32 deletions
@@ -303,6 +303,7 @@ pub struct CommitDiffView {
loading: bool,
error: Option<SharedString>,
pane: Entity<DiffPane>,
tasks: Vec<gpui::Task<Result<(), anyhow::Error>>>,
}
impl CommitDiffView {
@@ -336,6 +337,7 @@ impl CommitDiffView {
loading: true,
error: None,
pane,
tasks: Vec::new(),
}
}
@@ -383,7 +385,7 @@ impl CommitDiffView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
fn render_header(&self, cx: &mut Context<Self>) -> AnyElement {
@@ -79,8 +79,7 @@ pub struct PullRequestDetailView {
pane: Entity<DiffPane>,
commit_item_sizes: Rc<Vec<Size<Pixels>>>,
commit_scroll_handle: VirtualListScrollHandle,
/// The dock caches item panels, so without this observer a panel opened
/// before the store loaded would stay on its placeholder.
tasks: Vec<gpui::Task<Result<(), anyhow::Error>>>,
_subscription: Subscription,
}
@@ -124,6 +123,7 @@ impl PullRequestDetailView {
pane,
commit_item_sizes: Rc::new(Vec::new()),
commit_scroll_handle: VirtualListScrollHandle::new(),
tasks: Vec::new(),
_subscription: subscription,
}
}
@@ -327,7 +327,7 @@ impl PullRequestDetailView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
/// Open the diff of `commit_id` in the bottom dock of the area.
@@ -68,6 +68,7 @@ pub struct NewPullRequestView {
pane: Entity<DiffPane>,
scroll_handle: VirtualListScrollHandle,
item_sizes: Rc<Vec<Size<Pixels>>>,
tasks: Vec<gpui::Task<Result<(), anyhow::Error>>>,
_subscriptions: Vec<Subscription>,
}
@@ -323,6 +324,7 @@ impl NewPullRequestView {
pane,
scroll_handle: VirtualListScrollHandle::new(),
item_sizes: Rc::new(Vec::new()),
tasks: Vec::new(),
_subscriptions: subscriptions,
}
}
@@ -390,7 +392,8 @@ impl NewPullRequestView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
/// Branches and the current branch are read off the UI thread, then applied.
@@ -419,7 +422,8 @@ impl NewPullRequestView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
fn apply_checkout(
@@ -636,7 +640,8 @@ impl NewPullRequestView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
#[allow(clippy::too_many_arguments)]
@@ -830,7 +835,7 @@ impl NewPullRequestView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
fn submit(&mut self, window: &mut Window, cx: &mut Context<Self>) {
@@ -911,7 +916,7 @@ impl NewPullRequestView {
Ok(())
});
task.detach();
self.tasks.push(task);
}
fn open_commit_diff(&mut self, commit_id: &str, window: &mut Window, cx: &mut Context<Self>) {