mirror of
https://github.com/godotengine/godot
synced 2024-11-02 14:03:02 +00:00
Merge pull request #53807 from vnen/dont-share-arrays-and-dicts
This commit is contained in:
commit
472ff40f71
5 changed files with 62 additions and 2 deletions
|
@ -1301,12 +1301,12 @@ struct VariantZeroAssigner<Signal> {
|
|||
|
||||
template <>
|
||||
struct VariantZeroAssigner<Dictionary> {
|
||||
static _FORCE_INLINE_ void zero(Variant *v) {}
|
||||
static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_dictionary(v) = Dictionary(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VariantZeroAssigner<Array> {
|
||||
static _FORCE_INLINE_ void zero(Variant *v) {}
|
||||
static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_array(v) = Array(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# https://github.com/godotengine/godot/issues/48121
|
||||
|
||||
func test():
|
||||
var x := []
|
||||
var y := []
|
||||
x.push_back(y)
|
||||
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
|
||||
x.clear()
|
||||
|
||||
x = Array()
|
||||
y = Array()
|
||||
x.push_back(y)
|
||||
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
|
||||
x.clear()
|
||||
|
||||
x = Array().duplicate()
|
||||
y = Array().duplicate()
|
||||
x.push_back(y)
|
||||
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
|
||||
x.clear()
|
||||
|
||||
x = [].duplicate()
|
||||
y = [].duplicate()
|
||||
x.push_back(y)
|
||||
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
|
||||
x.clear()
|
||||
|
||||
x = Array()
|
||||
y = Array()
|
||||
x.push_back(y)
|
||||
print("TEST ARRAY ADD TO SELF: " + str(len(y)))
|
||||
x.clear()
|
|
@ -0,0 +1,6 @@
|
|||
GDTEST_OK
|
||||
TEST ARRAY ADD TO SELF: 0
|
||||
TEST ARRAY ADD TO SELF: 0
|
||||
TEST ARRAY ADD TO SELF: 0
|
||||
TEST ARRAY ADD TO SELF: 0
|
||||
TEST ARRAY ADD TO SELF: 0
|
|
@ -0,0 +1,19 @@
|
|||
# https://github.com/godotengine/godot/issues/48121
|
||||
|
||||
func test():
|
||||
var x := Dictionary()
|
||||
var y := Dictionary()
|
||||
y[0]=1
|
||||
y[1]=1
|
||||
y[2]=1
|
||||
print("TEST OTHER DICTIONARY: " + str(len(x)))
|
||||
x.clear()
|
||||
|
||||
x = Dictionary().duplicate()
|
||||
y = Dictionary().duplicate()
|
||||
y[0]=1
|
||||
y[1]=1
|
||||
y[2]=1
|
||||
print("TEST OTHER DICTIONARY: " + str(len(x)))
|
||||
x.clear()
|
||||
return
|
|
@ -0,0 +1,3 @@
|
|||
GDTEST_OK
|
||||
TEST OTHER DICTIONARY: 0
|
||||
TEST OTHER DICTIONARY: 0
|
Loading…
Reference in a new issue