-
Notifications
You must be signed in to change notification settings - Fork 27
fix(mcp): Resolve add_node resource leak and duplication issues #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alienfrenZyNo1
wants to merge
21
commits into
Coding-Solo:main
Choose a base branch
from
alienfrenZyNo1:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,324
−1,490
Conversation
This file contains 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
…ion-docs Add cursor integration docs
…cript-approach Feature/bundled gdscript approach
…id-support Changed Godot tooling to make use of Godot 4 API Added Debug mode, which adds additional tests and logging to Godot tools Added tools related to 4.4's uid files for scripts and resources other fixes and changes
…nfo-tool branches
…hing Implement robust pathing with improved validation
Parameter mapping
…parameter-mapping
improves parameter mapping
Modified godot_operations.gd to add a delay before freeing the instantiated scene root, preventing both RID leaks and node duplication.
- Make JSON param optional in godot_operations.gd _init - Add explicit param validation in GDScript functions - Add delay before quit() in GDScript for potential buffer flush - Infer resave_resources success via exit code & stderr in index.ts
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.
Fix
add_node
Resource Leak and Duplication IssuesThis PR addresses issues encountered when using the
add_node
MCP tool, which relies on thegodot_operations.gd
script running in headless mode.Problem:
RID allocations of type 'PN13RendererDummy14TextureStorage12DummyTextureE' were leaked at exit
errors, likely due to the instantiated scene root not being freed.scene_root.free()
) resulted in duplicate nodes being added to the saved scene file. This might be due to freeing the node before theResourceSaver.save()
operation fully completed in the headless environment.PackedScene
resource caused "Can't free a RefCounted object" errors.Solution:
add_node
function insrc/scripts/godot_operations.gd
has been modified:scene_root.free()
call is reinstated to prevent the RID leak.OS.delay_msec(100)
) is introduced afterResourceSaver.save()
and beforescene_root.free()
. This allows the save operation sufficient time to complete before the instantiated scene is freed, preventing the node duplication issue.PackedScene
was removed earlier in the debugging process.Verification:
add_node
tool after these changes..tscn
) that the node is added correctly without duplicates.