summaryrefslogtreecommitdiffstats
path: root/core/variant/array.cpp
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-01-22 11:07:48 +0200
committerDmitrii Maganov <vonagam@gmail.com>2023-01-27 05:28:08 +0200
commitabe6d6723219b592829fd9ba2a2c78950c83d64e (patch)
tree374101c2ae82959906d06c6a573d6cc63f5b0151 /core/variant/array.cpp
parentd1e5903c67956707948b1de370b807e3aad395b7 (diff)
downloadredot-engine-abe6d6723219b592829fd9ba2a2c78950c83d64e.tar.gz
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;
}
}