summaryrefslogtreecommitdiffstats
path: root/core/variant/array.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-27 10:29:52 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-27 10:29:52 +0100
commit9b1f85fe575497c276551e2be7a8d5b45406745e (patch)
tree5794586b8bae3ea1025408b4e9a0a0500013577c /core/variant/array.cpp
parent1a3b537bc7b53a647021bc7f77106edf1c4e920f (diff)
parentabe6d6723219b592829fd9ba2a2c78950c83d64e (diff)
downloadredot-engine-9b1f85fe575497c276551e2be7a8d5b45406745e.tar.gz
Merge pull request #71845 from vonagam/fix-read-only
GDScript: Fix test for read-only state of constants
Diffstat (limited to 'core/variant/array.cpp')
-rw-r--r--core/variant/array.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp
index f8af78f3c1..94d1596514 100644
--- a/core/variant/array.cpp
+++ b/core/variant/array.cpp
@@ -775,15 +775,9 @@ Variant Array::get_typed_script() const {
return _p->typed.script;
}
-void Array::set_read_only(bool p_enable) {
- if (p_enable == bool(_p->read_only != nullptr)) {
- return;
- }
- if (p_enable) {
+void Array::make_read_only() {
+ if (_p->read_only == nullptr) {
_p->read_only = memnew(Variant);
- } else {
- memdelete(_p->read_only);
- _p->read_only = nullptr;
}
}