-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 #64975 by introducing a new initialization level. #65018
Conversation
Looks like some of the singletons are now returning as nil, so perhaps this isn't quite the fix that is needed. Happy to have some guidance here. EDIT: has been fixed. |
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.
register_server_singletons
is already exactly where it supposed to be, you can't register singletons before servers are created and initialized, and the last (navigation server) one is initialized just one line before the current location of register_server_singletons
.
@bruvzg |
I guess the proper way to fix it, is to register each singleton as soon as server is created (from the server constructors), instead of dedicated |
Adding the new initialization level and using it fixes the issue and enables all server singletons to be retrieved. Perhaps
Let me know and I can change this. |
My 2c here: I'd rather introduce a I've myself spend quite some time to understand how to fetch a singleton (I thought I was using the API wrong when I was just querying it to soon) As a more general wish, I think it would be great to add a small comment in |
Would it be possible to rerun the workflows for this PR? Also please let me know if I should squash my commits (requires me to make a force push to the branch). |
Yes the commits should be squashed. I would also recommend rebasing at the same time so that you get the latest master commits. |
Fixes godotengine#64975 by enabling server singletons to be retrieved at initialization time. Previously, GDExtension libraries would fail to return Server singletons ie. 'global_get_singleton' at any defined initialization level. This enables Server singletons to be retrieved at GDNATIVE_INITIALIZATION_COMPLETE time so that GDExtensions can load all singletons on startup.
Have rebased against master, considering the feature freeze, will this PR and/or alternatively fixing #64975 still make it in before 4.0 release? |
I don't think we need another initialization level, but definitely it should not go after |
We reviewed this PR in the GDextension meeting, and we don't think this is the right solution to the problem. The singletons should be available a lot earlier than what they are right now so adding another initialization level is not the right solution to the issue. Singletons should instead be loaded earlier on. Since the solution we would prefer is very different from that proposed here, we'll close this PR. We've also added the corresponding issue to the 4.0 release milestone. Thank you nonetheless. |
Previously, GDExtension libraries would fail to return Server singletons
'global_get_singleton' at any initialization level #64975 (they were registered at the very end of setup2).
This enables Server singletons to be retrieved at the 'new'
GDNATIVE_INITIALIZATION_COMPLETE.