From 048c252602aa9e21175b7e125dbcae204e303b1f Mon Sep 17 00:00:00 2001 From: Yuri Sizov Date: Wed, 8 Mar 2023 19:46:55 +0100 Subject: Prevent cache corruption when saving resources in the editor (cherry picked from commit 496bd94c21dbda01fc7d9d0a108eecef21924024) --- modules/gdscript/gdscript.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index b6caefbdb5..1a1d021dbc 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1010,12 +1010,14 @@ void GDScript::_bind_methods() { } void GDScript::set_path(const String &p_path, bool p_take_over) { - String old_path = path; if (is_root_script()) { Script::set_path(p_path, p_take_over); } - this->path = p_path; + + String old_path = path; + path = p_path; GDScriptCache::move_script(old_path, p_path); + for (KeyValue> &kv : subclasses) { kv.value->set_path(p_path, p_take_over); } -- cgit v1.2.3