Merge pull request #82861 from mihe/gdext-entry-false

Fix extensions loading/initializing even when entry point fails
This commit is contained in:
Rémi Verschelde 2023-10-05 22:50:35 +02:00
commit 7c56631419
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -743,6 +743,7 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb
return OK; return OK;
} else { } else {
ERR_PRINT("GDExtension initialization function '" + p_entry_symbol + "' returned an error."); ERR_PRINT("GDExtension initialization function '" + p_entry_symbol + "' returned an error.");
OS::get_singleton()->close_dynamic_library(library);
return FAILED; return FAILED;
} }
} }
@ -928,6 +929,10 @@ Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path,
DirAccess::remove_absolute(p_extension->get_temp_library_path()); DirAccess::remove_absolute(p_extension->get_temp_library_path());
} }
#endif #endif
// Unreference the extension so that this loading can be considered a failure.
p_extension.unref();
// Errors already logged in open_library() // Errors already logged in open_library()
return err; return err;
} }