Fix extensions loading/initializing even when entry point fails #82861
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.
This fixes an apparent bug with the loading of extensions, where even if
false
is returned from the extension's entry point (here) the extension will still be considered successfully loaded byGDExtensionManager
(here) due to thep_extension
parameter pointing to a valid instance even after the entry point has reported a failure. This also results in it calling the extension module initalizer function even after its entry point has failed, which doesn't seem right.This also has the unfortunate side effect of preventing any actual error messages from being emitted to the editor log as a result of the failure in the extension entry point, since
EditorLog
is initialized as part ofMain::start()
, rather thanMain::setup()
where all the extension initialization happens. Currently you're able to see editor logs/errors for things likecompatibility_minimum
due to the fact that any loading of extensions gets retried as part ofEditorFileSystem::_scan_extensions
, but this will only ever actually be retried if the loading failed in the first place, which it doesn't without the change in this PR.CC: @dsnopek