mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 04:42:03 +00:00
fix(terminal): possible memory leak on exit (#37532)
Problem: On exit, it's possible that term_delayed_free() hasn't been called yet when the main loop is freed, in which case it won't be called ever. Solution: Don't bail out with term->destroy set when calling terminal_close() inside free_all_mem().
This commit is contained in:
@@ -583,9 +583,6 @@ void terminal_close(Terminal **termpp, int status)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
Terminal *term = *termpp;
|
||||
if (term->destroy) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef EXITFREE
|
||||
if (entered_free_all_mem) {
|
||||
@@ -596,6 +593,10 @@ void terminal_close(Terminal **termpp, int status)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (term->destroy) { // Destruction already scheduled on the main loop.
|
||||
return;
|
||||
}
|
||||
|
||||
bool only_destroy = false;
|
||||
|
||||
if (term->closed) {
|
||||
|
||||
Reference in New Issue
Block a user