summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-03-08 19:46:55 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-13 14:16:13 +0100
commit048c252602aa9e21175b7e125dbcae204e303b1f (patch)
treeb20fef4f58dacf5994ca3049d24ef9e934f01835 /modules/gdscript
parent7490f892387662bc14b77b4992fe66a9c678fb5c (diff)
Prevent cache corruption when saving resources in the editor
(cherry picked from commit 496bd94c21dbda01fc7d9d0a108eecef21924024)
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript.cpp6
1 files changed, 4 insertions, 2 deletions
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<StringName, Ref<GDScript>> &kv : subclasses) {
kv.value->set_path(p_path, p_take_over);
}