URI: 
       animation thread is now named. - icy_draw - icy_draw is the successor to mystic draw. fork / mirror
  HTML git clone https://git.drkhsh.at/icy_draw.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 2500346bf56dd756871ab7f3f7d759a1742669e7
   DIR parent 164df02f28e4cdf9e92e4a14eb5fd519d9946b24
  HTML Author: Mike Krüger <mkrueger@posteo.de>
       Date:   Wed,  4 Oct 2023 07:51:54 +0200
       
       animation thread is now named.
       
       Diffstat:
         M src/ui/editor/animation/encoding.rs |      15 ++++++++-------
         M src/ui/editor/animation/mod.rs      |       2 +-
       
       2 files changed, 9 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/src/ui/editor/animation/encoding.rs b/src/ui/editor/animation/encoding.rs
       @@ -25,7 +25,10 @@ pub fn start_encoding_thread(
            gl: Arc<glow::Context>,
            path: PathBuf,
            animator: Arc<std::sync::Mutex<Animator>>,
       -) -> (Receiver<usize>, JoinHandle<TerminalResult<()>>) {
       +) -> TerminalResult<(Receiver<usize>, JoinHandle<TerminalResult<()>>)> {
       +    if !animator.lock().unwrap().success() {
       +        return Err(anyhow::anyhow!("Animation is not finished."));
       +    }
            let (tx, rx) = std::sync::mpsc::channel();
            let mut buffer = Buffer::new((80, 25));
            buffer.is_terminal_buffer = false;
       @@ -58,11 +61,9 @@ pub fn start_encoding_thread(
            let dim = buffer_view.lock().get_buffer().get_font_dimensions();
            let width = (size.width * dim.width) as usize;
            let height = (size.height * dim.height) as usize;
       +    let t = thread::Builder::new()
       +    .name("Encoding".into())
       +    .spawn(move || ENCODERS[encoder].encode(&path, data, width, height, tx))?;
        
       -    (
       -        rx,
       -        thread::Builder::new()
       -            .name("named thread".into())
       -            .spawn(move || ENCODERS[encoder].encode(&path, data, width, height, tx)),
       -    )
       +    Ok((rx, t))
        }
   DIR diff --git a/src/ui/editor/animation/mod.rs b/src/ui/editor/animation/mod.rs
       @@ -83,7 +83,7 @@ impl AnimationEditor {
            }
        
            fn export(&mut self) -> TerminalResult<()> {
       -        let (rx, handle) = start_encoding_thread(self.export_type, self.gl.clone(), self.export_path.clone(), self.animator.clone());
       +        let (rx, handle) = start_encoding_thread(self.export_type, self.gl.clone(), self.export_path.clone(), self.animator.clone())?;
                self.rx = Some(rx);
                self.thread = Some(handle);
                self.encoding_frames = self.animator.lock().unwrap().frames.len();