1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Merge pull request #81521 from dsnopek/method-bind-default-argument-hash-fix

Fix method hashes with default arguments
This commit is contained in:
Rémi Verschelde
2023-09-22 22:03:30 +02:00
7 changed files with 937 additions and 8 deletions

View File

@@ -32,6 +32,7 @@
#include "core/config/engine.h"
#include "core/extension/gdextension.h"
#include "core/extension/gdextension_compat_hashes.h"
#include "core/io/file_access.h"
#include "core/io/xml_parser.h"
#include "core/object/class_db.h"
@@ -1306,6 +1307,17 @@ static GDExtensionMethodBindPtr gdextension_classdb_get_method_bind(GDExtensionC
const StringName methodname = *reinterpret_cast<const StringName *>(p_methodname);
bool exists = false;
MethodBind *mb = ClassDB::get_method_with_compatibility(classname, methodname, p_hash, &exists);
#ifndef DISABLE_DEPRECATED
// If lookup failed, see if this is one of the broken hashes from issue #81386.
if (!mb && exists) {
uint32_t mapped_hash;
if (GDExtensionCompatHashes::lookup_current_hash(classname, methodname, p_hash, &mapped_hash)) {
mb = ClassDB::get_method_with_compatibility(classname, methodname, mapped_hash, &exists);
}
}
#endif
if (!mb && exists) {
ERR_PRINT("Method '" + classname + "." + methodname + "' has changed and no compatibility fallback has been provided. Please open an issue.");
return nullptr;