Skip to content

Commit

Permalink
Fix sharing of typed arrays from constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Jun 6, 2024
1 parent 21d526e commit 41aa71f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions include/godot_cpp/variant/typed_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ class TypedArray : public Array {
_ref(p_array);
}
_FORCE_INLINE_ TypedArray(const Variant &p_variant) :
Array(p_variant.operator Array(), Variant::OBJECT, T::get_class_static(), Variant()) {
TypedArray(Array(p_variant)) {
}
_FORCE_INLINE_ TypedArray(const Array &p_array) :
Array(p_array, Variant::OBJECT, T::get_class_static(), Variant()) {
_FORCE_INLINE_ TypedArray(const Array &p_array) {
set_typed(Variant::OBJECT, T::get_class_static(), Variant());
if (is_same_typed(p_array)) {
_ref(p_array);
} else {
assign(p_array);
}
}
_FORCE_INLINE_ TypedArray() {
set_typed(Variant::OBJECT, T::get_class_static(), Variant());
Expand All @@ -65,10 +70,15 @@ class TypedArray : public Array {
_ref(p_array); \
} \
_FORCE_INLINE_ TypedArray(const Variant &p_variant) : \
Array(p_variant.operator Array(), m_variant_type, StringName(), Variant()) { \
TypedArray(Array(p_variant)) { \
} \
_FORCE_INLINE_ TypedArray(const Array &p_array) : \
Array(p_array, m_variant_type, StringName(), Variant()) { \
_FORCE_INLINE_ TypedArray(const Array &p_array) { \
set_typed(m_variant_type, StringName(), Variant()); \
if (is_same_typed(p_array)) { \
_ref(p_array); \
} else { \
assign(p_array); \
} \
} \
_FORCE_INLINE_ TypedArray() { \
set_typed(m_variant_type, StringName(), Variant()); \
Expand Down

0 comments on commit 41aa71f

Please sign in to comment.