Merged
Conversation
This way the objects are automatically freed when all references are
dropped. Prior to this, running the tests warned about leaked objects:
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
at: cleanup (core/object/object.cpp:2209)
ERROR: Resources still in use at exit (run with --verbose for details).
at: clear (core/io/resource.cpp:492)
When exiting the tree, the main panel is freed and should no longer be
updated. This avoids the following error when shutting down:
SCRIPT ERROR: Invalid call. Nonexistent function 'switch_block_code_node' in base 'Nil'.
at: BlockCodePlugin._refresh_block_code_node (res://addons/block_code/block_code_plugin.gd:160)
In e0a4208, the method name was changed.
Handling the inspector plugin as a static variable of the BlockCode
class means it can never be removed from inspector since we never know
when all BlockCode instances have been destroyed. That means it had to
be leaked as shown in the verbose Godot output:
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
at: cleanup (core/object/object.cpp:2209)
Leaked instance: EditorPlugin:1833129019089 - Node name:
Instead, add it once from the plugin entry point. That means it can also
be removed when the plugin exits rather than being leaked. This follows
the pattern documented in the Inspector Plugin tutorial[1].
1. https://docs.godotengine.org/en/stable/tutorials/plugins/editor/inspector_plugins.html.
dylanmccall
approved these changes
Jul 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some memory leak fixes I found looking at the Godot stdout. After this I get no more warnings about leaked objects in the tests or with minimal usage.