diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2020-05-05 12:53:05 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2020-05-05 17:54:15 +0200 |
commit | 46bfe4452f44d0264346227abc3431c76ee717dc (patch) | |
tree | 57ea824058e822f4aa5b4e75622a6f6edab24bb5 /core/callable.h | |
parent | 1c23a0cc7f879774f56404378db1bf86979e42d1 (diff) |
Fix object leaks caused by unfulfilled yields
Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted.
This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer.
Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being.
Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
Diffstat (limited to 'core/callable.h')
0 files changed, 0 insertions, 0 deletions