mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-30 23:37:17 +03:00
ncurses: avoid refering to dead NCursesUI in signal handler
This commit is contained in:
parent
4c1b48e314
commit
3a4859ecba
@ -78,6 +78,9 @@ static void set_color(Color fg_color, Color bg_color)
|
||||
static NCursesUI* signal_ui = nullptr;
|
||||
void on_term_resize(int)
|
||||
{
|
||||
if (not signal_ui)
|
||||
return;
|
||||
|
||||
int fd = open("/dev/tty", O_RDWR);
|
||||
winsize ws;
|
||||
if (fd == -1 or ioctl(fd, TIOCGWINSZ, (void*)&ws) != 0)
|
||||
@ -123,6 +126,8 @@ NCursesUI::NCursesUI()
|
||||
NCursesUI::~NCursesUI()
|
||||
{
|
||||
endwin();
|
||||
assert(signal_ui == this);
|
||||
signal_ui = nullptr;
|
||||
}
|
||||
|
||||
static void redraw(WINDOW* menu_win)
|
||||
|
Loading…
Reference in New Issue
Block a user