-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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 inability to use ResourceLoader in C# after threaded load in GDScript #92888
Fix inability to use ResourceLoader in C# after threaded load in GDScript #92888
Conversation
I don't think this is an appropriate solution to this problem, this isn't the way to detect if it's the default argument as it's not just an empty array but a specific instance, you could do that by This will break compatibility, as the method is clearly intended to support empty arrays (or the resize wouldn't be there) so this requires a different solution See: |
You are so right @AThousandShips, sorry for that, still learning!! I was misleading big time by the As an alternative solution, I created a static What do you think? |
d27a829
to
a61037d
Compare
I don't think this is a valid solution either, this should be solved on the script and engine side not the local site IMO, it's occurring in various places probably |
I understand that is not a perfect solution, but maybe a temporary solution? The alternative solution would be to have multiple overloads of the methods which seems a lot of work?!? Or maybe detect in GDScript that the default parameter is an empty array and create a new instance? That seems pretty specific. Maybe you can point me in the direction for a better solution?? |
I don't know a better solution sorry, this is not a simple problem, but this is a very ad-hoc and temporary solution in my opinion and I don't think it is an appropriate one, but I'll update the tags and we'll see what the core and GDScript teams say, but I feel this is too hacky to be a proper solution |
I've added a few style suggestions, just out of inertia. However, speaking about the issue itself, I totally agree with @AThousandShips. This needs to be discussed very carefully. |
All the suggestions should be done. Let me known if more changes are needed. |
a61037d
to
aef2ea0
Compare
I'll try analyse this but I still think this isn't the way to solve this |
The issue is about optional output parameters. On a deeper thought, it may not be that bad to have the sort of idiom being used here for cases like this, where the bindings allow to default output parameters. As long as we are consistent, it may be a fix, at least short-term. Ideally, though. the binding system would allow to be told a parameter is output so it automatically provides different instances if defaulted. That's pretty much the same this PR does, but making it more generic. There may be other less error-prone alternatives that could be discussed. |
b47b06b
to
6e0c85b
Compare
6e0c85b
to
3f44b1f
Compare
3f44b1f
to
7975476
Compare
Rebased to fix conflict with master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reiterating a better solution may be worked on in the future, this is fine to me as it's clean enough and fixes a pretty unfortunate issue.
7975476
to
27d1fb6
Compare
Thanks! |
Fixes #92798
As @raulsntos pointed out, the problem was from the modification of the default array. The hash of the method changed after the first call in GDScript.
I modified the method
ResourceLoader::load_threaded_get_status
to never modify the default array.I search for
DEFVAL(Array())
through all the code base and only found one another place where the default array was modified:OS::execute
. I modified this method as well.I was able to reproduce the problem and tested the correction with with the MRP project.