From d36d7e2a1c83141a3051d2c24b01c9a9e6104f89 Mon Sep 17 00:00:00 2001 From: George Marques Date: Sun, 23 Aug 2020 11:19:35 -0300 Subject: 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. --- modules/gdscript/gdscript.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'modules/gdscript/gdscript.cpp') 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 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; } } } -- cgit v1.2.3