-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Freeing a node on macOS + Godot Mono from _GuiInput
causes a crash
#100864
Comments
GridMapEditorPlugin
)_GuiInput
causes a crash (possibly related to GridMapEditorPlugin
)
_GuiInput
causes a crash (possibly related to GridMapEditorPlugin
)_GuiInput
causes a crash
Does using |
I concur. This is not safe use of Free. One would always want to use QueueFree instead of Free there. |
Yes, I think it may be worth adding some context here. I only recognized that this was unsafe usage after witnessing a crash. However, it still took me a few hours to create the minimal repro. It was difficult to pinpoint because:
I'm not trying to argue that this should result in a code fix, but perhaps this documentation could be clearer? Maybe an extra line like "When Godot tries to access a freed node, it may even result in a crash." Then again, this issue will now exist as a reference point for anyone searching for this in the future. Anyway, thank you for the prompt response! P.S. out of curiosity, why is |
Heck, I'd be in favor of just removing API access to Free. As in, making it an internal thing only. There is no real world scenario where a game/application designer using Godot would need to use a direct Free instead of a QueueFree. C# is managed code, GDScript is interpreted. Both consequently not in a position to have as much free control over freeing a node as a direct Free offers. So, yeah, documentation clarification is the least we should consider. Fully agreeing with you there. |
Tested versions
v4.3.stable.mono.official [77dcf97d8]
v4.4.dev.mono.custom_build.c602c168b
System information
Sonoma 14.6.1
Issue description
Freeing a node right when Godot calls the
GridMapEditorPlugin
destructor causes a crash. This only seems to happen on macOS; I had several people test on Windows for a combined total of 50+ times and it didn't repro there. I also couldn't get this to repro from GDScript alone.Stack trace for the crash:
As a workaround, calling
QueueFree
instead ofFree
should fix the issue.Steps to reproduce
.zip
Quick video repro here.
The most relevant code is this snippet, which simply frees one of the icons as soon as it receives mouse input:
Minimal reproduction project (MRP)
crashrepro.zip
The text was updated successfully, but these errors were encountered: