diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/object/class_db.cpp | 10 | ||||
-rw-r--r-- | core/string/ustring.cpp | 8 | ||||
-rw-r--r-- | core/variant/typed_array.h | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index c8c50fb957..e9fd8ad583 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1661,7 +1661,15 @@ void ClassDB::register_extension_class(ObjectGDExtension *p_extension) { c.name = p_extension->class_name; c.is_virtual = p_extension->is_virtual; if (!p_extension->is_abstract) { - c.creation_func = parent->creation_func; + // Find the closest ancestor which is either non-abstract or native (or both). + ClassInfo *concrete_ancestor = parent; + while (concrete_ancestor->creation_func == nullptr && + concrete_ancestor->inherits_ptr != nullptr && + concrete_ancestor->gdextension != nullptr) { + concrete_ancestor = concrete_ancestor->inherits_ptr; + } + ERR_FAIL_NULL_MSG(concrete_ancestor->creation_func, "Extension class " + String(p_extension->class_name) + " cannot extend native abstract class " + String(concrete_ancestor->name)); + c.creation_func = concrete_ancestor->creation_func; } c.inherits = parent->name; c.class_ptr = parent->class_ptr; diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 80ca51573c..3f11459a1e 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -3665,7 +3665,9 @@ String String::left(int p_len) const { return *this; } - return substr(0, p_len); + String s; + s.copy_from_unchecked(&get_data()[0], p_len); + return s; } String String::right(int p_len) const { @@ -3681,7 +3683,9 @@ String String::right(int p_len) const { return *this; } - return substr(length() - p_len); + String s; + s.copy_from_unchecked(&get_data()[length() - p_len], p_len); + return s; } char32_t String::unicode_at(int p_idx) const { diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h index 98afc7e717..055c52aa63 100644 --- a/core/variant/typed_array.h +++ b/core/variant/typed_array.h @@ -230,4 +230,7 @@ MAKE_TYPED_ARRAY_INFO(Vector<Vector3>, Variant::PACKED_VECTOR3_ARRAY) MAKE_TYPED_ARRAY_INFO(Vector<Color>, Variant::PACKED_COLOR_ARRAY) MAKE_TYPED_ARRAY_INFO(IPAddress, Variant::STRING) +#undef MAKE_TYPED_ARRAY +#undef MAKE_TYPED_ARRAY_INFO + #endif // TYPED_ARRAY_H |