mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 12:41:08 +08:00
Fix potential assertion failure on SIGTERM
If SIGTERM is delivered to a background thread, a function call to sanitize the reader state would crash in assert_is_main_thread(). In this case we are about to exit so there's no need to fix the reader state. Skip it on background threads.
This commit is contained in:
parent
49b88868df
commit
fe3e3b3b50
|
@ -12,7 +12,7 @@ use crate::key::{
|
|||
Key, Modifiers,
|
||||
};
|
||||
use crate::reader::{reader_current_data, reader_test_and_clear_interrupted};
|
||||
use crate::threads::iothread_port;
|
||||
use crate::threads::{iothread_port, is_main_thread};
|
||||
use crate::universal_notifier::default_notifier;
|
||||
use crate::wchar::{encode_byte_to_char, prelude::*};
|
||||
use crate::wutil::encoding::{mbrtowc, mbstate_t, zero_mbstate};
|
||||
|
@ -493,7 +493,9 @@ pub(crate) fn terminal_protocols_disable_ifn() {
|
|||
if IS_TMUX.load() {
|
||||
let _ = write_to_fd("\x1b[?1004l".as_bytes(), STDOUT_FILENO);
|
||||
}
|
||||
reader_current_data().map(|data| data.save_screen_state());
|
||||
if is_main_thread() {
|
||||
reader_current_data().map(|data| data.save_screen_state());
|
||||
}
|
||||
TERMINAL_PROTOCOLS.store(false, Ordering::Release);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user