summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-08-23 11:19:35 -0300
committerGeorge Marques <george@gmarqu.es>2020-08-23 12:55:27 -0300
commitd36d7e2a1c83141a3051d2c24b01c9a9e6104f89 (patch)
tree12f1cb5465c8df99519a723e54a6dbfd2dda6a6a /modules/gdscript/gdscript.cpp
parent58f5c2bab6f03e0c887447532832b18ac76ad250 (diff)
downloadredot-engine-d36d7e2a1c83141a3051d2c24b01c9a9e6104f89.tar.gz
GDScript: Use pointer instead of references in cache
They are not supposed to be kept alive and this is cleaner and less error-prone than unreferencing the elements.
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r--modules/gdscript/gdscript.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 541d46a2af..0263e32c5b 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -603,10 +603,8 @@ Error GDScript::reload(bool p_keep_state) {
}
if (!source_path.empty()) {
MutexLock lock(GDScriptCache::singleton->lock);
- Ref<GDScript> self(this);
if (!GDScriptCache::singleton->shallow_gdscript_cache.has(source_path)) {
- GDScriptCache::singleton->shallow_gdscript_cache[source_path] = self;
- self->unreference();
+ GDScriptCache::singleton->shallow_gdscript_cache[source_path] = this;
}
}
}