-
-
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
Fix some arguments being passed as references in virtual functions #92175
base: master
Are you sure you want to change the base?
Conversation
ee46c66
to
0a68e66
Compare
I'd appreciate if someone using C# could test if the unchanged interface allows returning values from these methods through the parameters, will confirm if the GDScript even works as is later today, if either doesn't this makes this change unavoidable IMO |
As per godotengine/godot-cpp#1471 I believe this may be related to a wider issue - some of the reference parameters that shouldn't be In my limited testing with an I dropped some breakpoints in I tried to do more testing over the last week with my godot build to create a fixed version, but I'm not familiar enough with the GDVIRTUAL system to make the necessary modifications. I've not tested any interface beyond
@AThousandShips I also tested it in an |
Thank you so much for your testing! Then at least the GDScript side works, can't test with C# at the moment but might be able to later |
0a68e66
to
e4d27a6
Compare
e4d27a6
to
ddced1a
Compare
ddced1a
to
8821bd0
Compare
9bf5d1a
to
4fa0a75
Compare
4fa0a75
to
c2c5e1c
Compare
c2c5e1c
to
a6bc6de
Compare
a6bc6de
to
a216584
Compare
a216584
to
0327bbd
Compare
These can't be used safely in extensions, replaced with `Dictionary` returns
0327bbd
to
dd724f7
Compare
These can't be used safely in extensions, replaced with
Dictionary
returnsA few cases could do with this improvement, like
EditorSceneFormatImporter::_import_scene
but focused on cases that had arguments that were unusable, at least generallyThis is patterned on the way
ScriptLanguageExtension::_validate
and similar are written, alternatively this could passGDExtensionPtr
but that would make these methods inaccessible from scripting, which considering some of them have documentation showing how to use them in GDScript and C# feels like the wrong way to go. Those cases do work (as far as I know, haven't tested the unchanged code) in at least GDScript (don't know if the passed references are useable in C#) but they use constant references in at least godot-cpp, which couldn't be changed without making broad changes there without handling other cases as there's no way to distinguish the cases.This might be considered too significant a breakage, but it feels unsafe and strange if users have to use
const_cast
to be able to use these, and it might not be guaranteed that these passed arguments remain linked in the future since they aren't intended to be mutable based on the interfaceEdit: the ability to modify these values seems to be unreliable, and might not work correctly at least in godot-cpp, so this change appears more necessary, this could be this issue surfacing in godot-cpp (so would be specific to typed arrays):
Todo:
const
references godot-cpp#1471