mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-08 21:25:31 +02:00
Prevent exit callback instance leaks
De-references pty_baton's exit callback after it is called so it can be automatically released, preventing leaked instances. Adds basic implementation for Pipe's get_status() method and forces PTY to wait for child process to exit to ensure exit callback is cleaned up. Adds a test to check that exit callback is still called as usual.
This commit is contained in:
parent
38927e0a3e
commit
0ae1d80abb
5 changed files with 24 additions and 4 deletions
|
@ -445,8 +445,10 @@ static void pty_after_waitpid(uv_async_t *async) {
|
|||
|
||||
Array argv = Array::make(baton->exit_code, baton->signal_code);
|
||||
|
||||
if (baton->cb != nullptr && baton->cb->is_valid())
|
||||
if (baton->cb != nullptr && baton->cb->is_valid()) {
|
||||
baton->cb->call_funcv(argv);
|
||||
baton->cb = (Ref<FuncRef>)nullptr;
|
||||
}
|
||||
|
||||
uv_close((uv_handle_t *)async, pty_after_close);
|
||||
}
|
||||
|
@ -669,4 +671,4 @@ void PTYUnix::_register_methods() {
|
|||
register_method("process", &PTYUnix::process);
|
||||
}
|
||||
|
||||
void PTYUnix::_init() {}
|
||||
void PTYUnix::_init() {}
|
Loading…
Add table
Add a link
Reference in a new issue