Check if baton FuncRef is valid before calling call_funcv()

Often when closing a terminal in the terminal panel the error message
'Condition "!obj" is true.' would be printed to console.

This was due to the call_funcv() method being called on an invalid
FuncRef instance (invalid because it had already been deleted or queued
for delection).

Now we check the instance is valid before calling the method.
This commit is contained in:
Leroy Hopson 2022-06-01 17:03:42 +07:00
parent d124f20f36
commit bea5d1c27d
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 4 additions and 3 deletions

View file

@ -25,7 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- The `kill()` method of unix PTY node can now be called without error as the underlying - The `kill()` method of unix PTY node can now be called without error as the underlying
`pipe.close()` method of the gdnative library is now registered. `pipe.close()` method of the gdnative library is now registered.
- Fixed 'Condition "!obj" is true.' error that would often print to console when
closing terminals in the Terminal panel of the editor plugin.
## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25 ## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25

View file

@ -445,7 +445,7 @@ static void pty_after_waitpid(uv_async_t *async) {
Array argv = Array::make(baton->exit_code, baton->signal_code); Array argv = Array::make(baton->exit_code, baton->signal_code);
ERR_FAIL_COND(baton->cb == nullptr); if (baton->cb != nullptr && baton->cb->is_valid())
baton->cb->call_funcv(argv); baton->cb->call_funcv(argv);
uv_close((uv_handle_t *)async, pty_after_close); uv_close((uv_handle_t *)async, pty_after_close);