Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash Potentially Following Extreme Resize? #268

Closed
TheLostLambda opened this issue Apr 14, 2021 · 1 comment
Closed

Crash Potentially Following Extreme Resize? #268

TheLostLambda opened this issue Apr 14, 2021 · 1 comment

Comments

@TheLostLambda
Copy link
Member

TheLostLambda commented Apr 14, 2021

I left Zellij to run overnight on my computer but it seems that, when turning back on my displays this morning (which does some strange things with the windows on my screen), Zellij has crashed:

Originating Thread(s):
1. pty_thread: NewTab
2. stream_terminal_bytes: AsyncTask
3. screen_thread: HandlePtyBytes

Error: thread 'screen' panicked at 'insertion index (is 55) should be <= len (is 31)': library/alloc/src/vec.rs:1018
   0: zellij::common::errors::handle_panic
   1: std::panicking::rust_panic_with_hook
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:597:17
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:499:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:141:18
   4: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   5: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   6: alloc::vec::Vec<T>::insert::assert_failed
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/vec.rs:1018:13
   7: zellij::client::panes::grid::Grid::delete_lines_in_scroll_region
   8: vte::Parser::perform_action
   9: <zellij::client::panes::terminal_pane::TerminalPane as zellij::client::tab::Pane>::handle_pty_bytes
  10: std::sys_common::backtrace::__rust_begin_short_backtrace
  11: core::ops::function::FnOnce::call_once{{vtable.shim}}
  12: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys/unix/thread.rs:71:17
  13: start_thread
  14: thread_start

I think the issue is with the insert() here?

pub fn delete_lines_in_scroll_region(
        &mut self,
        count: usize,
        pad_character: TerminalCharacter,
    ) {
        if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region {
            let current_line_index = self.cursor.y;
            if current_line_index >= scroll_region_top && current_line_index <= scroll_region_bottom
            {
                // when deleting lines inside the scroll region, we must make sure it stays the
                // same size (and that other lines below it aren't shifted inside it)
                // so we delete the current line(s) and add an empty line at the end of the scroll
                // region
                for _ in 0..count {
                    self.viewport.remove(current_line_index);
                    let columns = vec![pad_character; self.width];
                    self.viewport
                        .insert(scroll_region_bottom, Row::from_columns(columns).canonical());
                }
            }
        }
    }
@imsnif
Copy link
Member

imsnif commented Apr 15, 2021

Fixed, thanks!

@imsnif imsnif closed this as completed Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants