-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Panic on accessing Gd<Self>
in contructors
#997
Comments
Gd<Self>
in contructors
The crash isn't truly silent, if you run Godot from the command line you'll be able to see the panic output. |
|
My apologies, I mistook it with gdext/godot-core/src/obj/base.rs Line 96 in b619959
Does the terminal window stay open after Godot crashes? |
Np, I also thought that it might be Re terminal yes, the exit code is |
Actually the silent part seems to be an unrelated Git Bash issue, running Godot CLI via PowerShell outputs a panic message: C:\path\to\godot-core-0.2.2:
downcast from Object to MyObject failed; instance Gd { id: 1109376686628, class: Object } |
It's closely related to #557 though, as the use case is the same: running certain initialization logic in the Generally it might only be safe to hand out Small note: please avoid using the term "crash" if there's a panic. The latter is controlled, even if not always desirable 😉 |
Gd<Self>
in contructorsGd<Self>
in contructors
Unlike I'll continue with any general constructor API discussions in #557 to have everything in one place. Re panic note, agreed, my apologies. When I opened the issue I didn't have the panic output yet due to a terminal issue, so it seemed like an unexplained crash. |
Accessing
Gd<Self>
pointer in constructorssilentlycrashes the editor.I haven't dug too deep into the library implementation so I'm not sure if this is a bug or a constructor API design limitation, but considering that
WithBaseField::to_gd
is part of the public API and the equivalent C++ and GDScript code works fine I thought I'd mention it.Minimal example:
The intended use case was to connect some local signals in the constructor while building a custom editor plugin, which seems to be a common pattern in engine code. This requires
Gd<Self>
for constructing a callable viaCallable::from_object_method(&instance.to_gd(), "method_name")
.EDIT: Removed "silent" since it was an unrelated issue
The text was updated successfully, but these errors were encountered: