GDExtension: Call startup callback only after reload is fully finished #109309
+11
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was brought up on chat.godotengine.org by @Yarwin that we're currently calling a GDExtension's startup callback before the extension has been fully reloaded, when any objects that use its classes are in an inconsistent state.
Instead, we'd want the startup callback to be called after reload is fully finished, so that the state is roughly the same as if the extension was being loaded for the first time.
This PR attempts to do that, by moving the "after load" stuff into a
_finish_load_extension()method, which won't be called automatically on reload, so that the reload process can call it at the endThis startup callback was functionality added for Godot 4.5, it'd be good to get the order correct before release