-
-
Notifications
You must be signed in to change notification settings - Fork 583
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
Unable to validate freed Object #1587
Comments
Thanks! Ack, yeah, in the case you give here (a bound function that takes a The problem is that I'm not sure how we can add that without adding something new in Godot, and so, this may need to be a Godot 4.4 thing. And if that's the case, then I think we'll probably need to revert the removal of This is unfortunate, because I don't think it's very common to accept |
@dsnopek Agreed that something like A more realistic example than I provided above (and the case that revealed this issue to me) is a method that accepts a higher-order data structure e.g. Dictionary that predicate a Variant but is expected to contain an Object. |
I also ran into this. I tried to use |
Godot version
4.3
godot-cpp version
4.3 (e298f43)
System information
macOS Sonoma 14.6.1
Issue description
With the removal of
UtilityFunctions::is_instance_valid()
(#1513), it is impossible to validate an Object passed to a GDExtension method as a Variant.Spawned from this comment. Using
ObjectDB::get_instance()
as suggested here and here isn't a perfect replacement. Starting with a Variant that represents a freed Object, we're unable to get an object ID in order to use ObjectDB::get_instance(). After ensuring a Variant is of type Object, an operator Object*() call causes a crash.Previously,
UtilityFunctions::is_instance_valid()
could be used to validate an object. It's possible to usevariant.stringify() == "<Freed Object>"
as a hacky workaround although obviously not ideal.Steps to reproduce
Add the following method to a GDExtension class.
Use the GDExtension function via GDScript as follows.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: