summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-01-23 00:46:53 +0100
committerGitHub <noreply@github.com>2022-01-23 00:46:53 +0100
commit668d6a1c5ccface4f4ecc95ce4cf00cd5d90b1db (patch)
treece530b5da477c3aa727a7c0b4e3a686c17f2b655
parent5e26a275bbf38db357df6103768f42038f54cc71 (diff)
parente2ed9d13ebdf4fe2a7a7a4eacd47262310ffa3e3 (diff)
Merge pull request #56337 from cdemirer/fix-array-dictionary-id
-rw-r--r--core/variant/array.cpp2
-rw-r--r--core/variant/dictionary.cpp2
-rw-r--r--tests/core/variant/test_dictionary.h2
3 files changed, 3 insertions, 3 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index 3d2f337442..1b39558dff 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -631,7 +631,7 @@ Variant Array::max() const {
}
const void *Array::id() const {
- return _p->array.ptr();
+ return _p;
}
Array::Array(const Array &p_from, uint32_t p_type, const StringName &p_class_name, const Variant &p_script) {
diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp
index cc04ae712b..0f2f8fc8ed 100644
--- a/core/variant/dictionary.cpp
+++ b/core/variant/dictionary.cpp
@@ -350,7 +350,7 @@ void Dictionary::operator=(const Dictionary &p_dictionary) {
}
const void *Dictionary::id() const {
- return _p->variant_map.id();
+ return _p;
}
Dictionary::Dictionary(const Dictionary &p_from) {
diff --git a/tests/core/variant/test_dictionary.h b/tests/core/variant/test_dictionary.h
index 79d53fa64e..729035919d 100644
--- a/tests/core/variant/test_dictionary.h
+++ b/tests/core/variant/test_dictionary.h
@@ -196,7 +196,7 @@ TEST_CASE("[Dictionary] Duplicate dictionary") {
Dictionary shallow_d = d.duplicate(false);
CHECK_MESSAGE(shallow_d.id() != d.id(), "Should create a new array");
CHECK_MESSAGE(Dictionary(shallow_d[1]).id() == Dictionary(d[1]).id(), "Should keep nested dictionary");
- CHECK_MESSAGE(Array(shallow_d[2]).id() == Array(d[2]).id(), "Should keep nested array");
+ CHECK_MESSAGE(Array(shallow_d[k2]).id() == Array(d[k2]).id(), "Should keep nested array");
CHECK_EQ(shallow_d, d);
shallow_d[0] = 0;
CHECK_NE(shallow_d, d);