From abe6d6723219b592829fd9ba2a2c78950c83d64e Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Sun, 22 Jan 2023 11:07:48 +0200 Subject: GDScript: Fix test for read-only state of constants --- core/variant/array.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'core/variant/array.cpp') 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; } } -- cgit v1.2.3