diff options
author | qkzk <qu3nt1n@gmail.com> | 2024-09-16 12:55:05 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2024-09-16 12:55:05 +0200 |
commit | b6657fa3a8b8c827a761e188b4dc371e36103f16 (patch) | |
tree | a1ac2ec86d8a05d75c5c3121631160a12c4f4ecf | |
parent | c849a0350d2f805a0a7623cb6569a6d9653c49e4 (diff) |
Fix: Crash when quiting. "sending on a closed channel". From quit -> refresher::quitv0.1.28-dev
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | development.md | 1 | ||||
-rw-r--r-- | src/app/application.rs | 4 | ||||
-rw-r--r-- | src/app/displayer.rs | 9 | ||||
-rw-r--r-- | src/app/refresher.rs | 10 |
5 files changed, 15 insertions, 10 deletions
@@ -4,3 +4,4 @@ *compress_example *nohup* *token* +*keyb.txt* diff --git a/development.md b/development.md index e0a3e404..867c1667 100644 --- a/development.md +++ b/development.md @@ -1101,6 +1101,7 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally. - [x] Compress should use the selected file if nothing is flagged - [x] Fix: opening tree mode with selection on "." doesn't display "." as selected - [x] refactor draw tree line +- [x] Fix: Crash when quiting. "sending on a closed channel". From quit -> refresher::quit - [ ] Badges to latest version ## TODO diff --git a/src/app/application.rs b/src/app/application.rs index 5fc416e7..c67e7db1 100644 --- a/src/app/application.rs +++ b/src/app/application.rs @@ -183,8 +183,8 @@ impl FM { clear_tmp_file(); drop(self.event_reader); drop(self.event_dispatcher); - self.displayer.quit()?; - self.refresher.quit()?; + self.displayer.quit(); + self.refresher.quit(); let status = self .status diff --git a/src/app/displayer.rs b/src/app/displayer.rs index 29ca9bd2..2e4d662e 100644 --- a/src/app/displayer.rs +++ b/src/app/displayer.rs @@ -7,6 +7,7 @@ use anyhow::{anyhow, Result}; use crate::app::Status; use crate::io::Display; +use crate::log_info; pub struct Displayer { tx: mpsc::Sender<()>, @@ -45,10 +46,12 @@ impl Displayer { Self { tx, handle } } - pub fn quit(self) -> Result<()> { + pub fn quit(self) { crate::log_info!("stopping display loop"); - self.tx.send(())?; + match self.tx.send(()) { + Ok(()) => (), + Err(e) => log_info!("Displayer::quit error {e:?}"), + }; let _ = self.handle.join(); - Ok(()) } } diff --git a/src/app/refresher.rs b/src/app/refresher.rs index 99aea574..cf45bf6e 100644 --- a/src/app/refresher.rs +++ b/src/app/refresher.rs @@ -3,8 +3,6 @@ use std::sync::Arc; use std::thread; use std::time::Duration; -use anyhow::Result; - use crate::event::FmEvents; use crate::log_info; @@ -57,9 +55,11 @@ impl Refresher { /// Send a quit message to the receiver, signaling it to quit. /// Join the refreshing thread which should be terminated. - pub fn quit(self) -> Result<()> { - self.tx.send(())?; + pub fn quit(self) { + match self.tx.send(()) { + Ok(_) => (), + Err(e) => log_info!("Refresher::quit error {e:?}"), + }; let _ = self.handle.join(); - Ok(()) } } |