mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
event: Ensure the event loop has been cleaned up in event_teardown
- Add input_teardown/signal_teardown to take care of closing signal/stdin handles. - Call those functions in event_teardown, and ensure there are no active handles by entering an infinite loop when there are unclosed handles(think of this as an assertion that can't go unoticed on travis). - Move event_teardown call to the end of mch_exit. That is required because event_poll may still be called in that function.
This commit is contained in:
parent
a1dd70b1d0
commit
75a5674cd2
@ -71,7 +71,15 @@ void event_teardown(void)
|
|||||||
channel_teardown();
|
channel_teardown();
|
||||||
job_teardown();
|
job_teardown();
|
||||||
server_teardown();
|
server_teardown();
|
||||||
|
signal_teardown();
|
||||||
input_stop();
|
input_stop();
|
||||||
|
input_teardown();
|
||||||
|
do {
|
||||||
|
// This will loop forever if we leave any unclosed handles. Currently it is
|
||||||
|
// the most reliable way to use travis for verifying the no libuv-related
|
||||||
|
// bugs(which can be hard to track later) were introduced on a PR.
|
||||||
|
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||||
|
} while (uv_loop_close(uv_default_loop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for some event
|
// Wait for some event
|
||||||
|
@ -52,6 +52,15 @@ void input_init(void)
|
|||||||
rstream_set_file(read_stream, read_cmd_fd);
|
rstream_set_file(read_stream, read_cmd_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void input_teardown(void)
|
||||||
|
{
|
||||||
|
if (embedded_mode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rstream_free(read_stream);
|
||||||
|
}
|
||||||
|
|
||||||
// Listen for input
|
// Listen for input
|
||||||
void input_start(void)
|
void input_start(void)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,20 @@ void signal_init(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void signal_teardown(void)
|
||||||
|
{
|
||||||
|
signal_stop();
|
||||||
|
uv_close((uv_handle_t *)&sint, NULL);
|
||||||
|
uv_close((uv_handle_t *)&spipe, NULL);
|
||||||
|
uv_close((uv_handle_t *)&shup, NULL);
|
||||||
|
uv_close((uv_handle_t *)&squit, NULL);
|
||||||
|
uv_close((uv_handle_t *)&sterm, NULL);
|
||||||
|
uv_close((uv_handle_t *)&swinch, NULL);
|
||||||
|
#ifdef SIGPWR
|
||||||
|
uv_close((uv_handle_t *)&spwr, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void signal_stop(void)
|
void signal_stop(void)
|
||||||
{
|
{
|
||||||
uv_signal_stop(&sint);
|
uv_signal_stop(&sint);
|
||||||
|
@ -522,8 +522,6 @@ void mch_exit(int r)
|
|||||||
{
|
{
|
||||||
exiting = TRUE;
|
exiting = TRUE;
|
||||||
|
|
||||||
event_teardown();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
settmode(TMODE_COOK);
|
settmode(TMODE_COOK);
|
||||||
mch_restore_title(3); /* restore xterm title and icon name */
|
mch_restore_title(3); /* restore xterm title and icon name */
|
||||||
@ -559,7 +557,7 @@ void mch_exit(int r)
|
|||||||
mac_conv_cleanup();
|
mac_conv_cleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
event_teardown();
|
||||||
|
|
||||||
#ifdef EXITFREE
|
#ifdef EXITFREE
|
||||||
free_all_mem();
|
free_all_mem();
|
||||||
|
Loading…
Reference in New Issue
Block a user