diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-10 13:53:26 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-10 13:53:26 +0200 |
commit | 51bb3c36ddc78de036c562a8e599bdfd5345f2b5 (patch) | |
tree | 0be2de6e73ff865d95df3b336ec5b02c85b1e10d /core | |
parent | ddb97a0b353e4a5de2fdd0195a77efdbb022eacf (diff) | |
parent | 51c411c7ad46ea25565058ac9e08ae1528b5ba85 (diff) |
Merge pull request #66584 from rune-scape/rune-validated-call-obj-bug
Fix unset `ObjectID` with validated `get_object()` call
Diffstat (limited to 'core')
-rw-r--r-- | core/variant/variant_internal.h | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 874a183d29..7ae2368fe4 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -1047,7 +1047,7 @@ struct VariantInternalAccessor<PackedColorArray> { template <> struct VariantInternalAccessor<Object *> { static _FORCE_INLINE_ Object *get(const Variant *v) { return const_cast<Object *>(*VariantInternal::get_object(v)); } - static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { *VariantInternal::get_object(v) = const_cast<Object *>(p_value); } + static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { VariantInternal::object_assign(v, p_value); } }; template <> @@ -1532,27 +1532,4 @@ struct VariantTypeConstructor { } }; -template <> -struct VariantTypeConstructor<Object *> { - _FORCE_INLINE_ static void variant_from_type(void *p_variant, void *p_value) { - Variant *variant = reinterpret_cast<Variant *>(p_variant); - VariantInitializer<Object *>::init(variant); - Object *object = *(reinterpret_cast<Object **>(p_value)); - if (object) { - if (object->is_ref_counted()) { - if (!VariantInternal::initialize_ref(object)) { - return; - } - } - VariantInternalAccessor<Object *>::set(variant, object); - VariantInternalAccessor<ObjectID>::set(variant, object->get_instance_id()); - } - } - - _FORCE_INLINE_ static void type_from_variant(void *p_value, void *p_variant) { - Object **value = reinterpret_cast<Object **>(p_value); - *value = VariantInternalAccessor<Object *>::get(reinterpret_cast<Variant *>(p_variant)); - } -}; - #endif // VARIANT_INTERNAL_H |