This commit is contained in:
sxyazi 2024-03-13 23:46:25 +08:00
parent 7de161de5c
commit 1be8f2c307
No known key found for this signature in database
4 changed files with 12 additions and 1 deletions

View file

@ -25,7 +25,7 @@ impl Tabs {
return;
}
self.items.remove(opt.idx);
self.items.remove(opt.idx).shutdown();
if opt.idx <= self.idx {
self.set_idx(self.absolute(1));
}

View file

@ -23,6 +23,8 @@ impl Manager {
mimetype: Default::default(),
}
}
pub fn shutdown(&mut self) { self.tabs.iter_mut().for_each(|t| t.shutdown()); }
}
impl Manager {

View file

@ -48,6 +48,14 @@ impl From<&Url> for Tab {
fn from(url: &Url) -> Self { Self::from(url.clone()) }
}
impl Tab {
pub fn shutdown(&mut self) {
if let Some(handle) = self.search.take() {
handle.abort();
}
}
}
impl Tab {
// --- Current
pub fn selected_or_hovered(&self) -> Vec<&Url> {

View file

@ -8,6 +8,7 @@ use crate::app::App;
impl App {
pub(crate) fn quit(&mut self, opt: EventQuit) -> ! {
self.cx.tasks.shutdown();
self.cx.manager.shutdown();
if !opt.no_cwd_file {
self.cwd_to_file();