mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: tiocswinsz: don’t remove/close the fd passed as argument
There’s a chance the resize timeout FD was closed, and *reused*, after epoll() told us the FD is readable, but before our callback runs. Thus, closing the FD provided as an argument is dangerous, as it may refer to something completely different.
This commit is contained in:
parent
0c777d825d
commit
9658e9cc18
1 changed files with 4 additions and 2 deletions
6
render.c
6
render.c
|
|
@ -3119,8 +3119,10 @@ fdm_tiocswinsz(struct fdm *fdm, int fd, int events, void *data)
|
|||
if (events & EPOLLIN)
|
||||
tiocswinsz(term);
|
||||
|
||||
fdm_del(fdm, fd);
|
||||
term->window->resize_timeout_fd = -1;
|
||||
if (term->window->resize_timeout_fd >= 0) {
|
||||
fdm_del(fdm, term->window->resize_timeout_fd);
|
||||
term->window->resize_timeout_fd = -1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue