bugfix: fix coredump when resizing terminal window
In the signal handler for the signal SIGWINCH tty_term_resize, we call tty_dpy_invalidate function. In this function, we change the screen_size and other critical fields. While the process is executing the function tty_dpy_flush, and another SIGWINCH occurs, then the screen_size is changed. And tty_dpy_flush will access invalid memory which leads to coredump. In the signal hander of SIGWINCH, we only need to set the flag complete_refresh.
This commit is contained in:
parent
7303a8b693
commit
6cd79d45df
3 changed files with 4 additions and 7 deletions
2
qe.h
2
qe.h
|
|
@ -110,7 +110,7 @@ void set_write_handler(int fd, void (*cb)(void *opaque), void *opaque);
|
|||
int set_pid_handler(int pid,
|
||||
void (*cb)(void *opaque, int status), void *opaque);
|
||||
void url_exit(void);
|
||||
void url_redisplay(void);
|
||||
void url_redisplay(QEditScreen *s);
|
||||
void register_bottom_half(void (*cb)(void *opaque), void *opaque);
|
||||
void unregister_bottom_half(void (*cb)(void *opaque), void *opaque);
|
||||
|
||||
|
|
|
|||
6
tty.c
6
tty.c
|
|
@ -658,11 +658,7 @@ static void tty_term_resize(qe__unused__ int sig)
|
|||
QEditScreen *s = tty_screen;
|
||||
|
||||
if (s) {
|
||||
tty_dpy_invalidate(s);
|
||||
|
||||
//fprintf(stderr, "tty_term_resize: width=%d, height=%d\n", s->width, s->height);
|
||||
|
||||
url_redisplay();
|
||||
url_redisplay(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
3
unix.c
3
unix.c
|
|
@ -346,9 +346,10 @@ void url_exit(void)
|
|||
}
|
||||
|
||||
/* asynchronous redisplay signal received */
|
||||
void url_redisplay(void)
|
||||
void url_redisplay(QEditScreen *s)
|
||||
{
|
||||
url_display_request = 1;
|
||||
s->qs->complete_refresh = 1;
|
||||
}
|
||||
|
||||
int get_clock_ms(void) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue