diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-06-25 14:09:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 14:09:28 +0200 |
commit | b1920730010854b4b470e047af3fb05e5113060c (patch) | |
tree | 325b7e7f6a67e02efd4aa85a8161472592b04b48 /core/io/resource_format_binary.cpp | |
parent | b26d924f225d5181219066c4b080cc41ed349179 (diff) | |
parent | e772b65d92dbd5b36fb003458d7fe0fd528abcea (diff) | |
download | redot-engine-b1920730010854b4b470e047af3fb05e5113060c.tar.gz |
Merge pull request #62309 from reduz/remake-resource-thread-safety
Remake ResourceCache thread safety code and API
Diffstat (limited to 'core/io/resource_format_binary.cpp')
-rw-r--r-- | core/io/resource_format_binary.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 2469e1a4be..b1c50e829c 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -693,7 +693,7 @@ Error ResourceLoaderBinary::load() { } if (cache_mode == ResourceFormatLoader::CACHE_MODE_REUSE && ResourceCache::has(path)) { - Ref<Resource> cached = ResourceCache::get(path); + Ref<Resource> cached = ResourceCache::get_ref(path); if (cached.is_valid()) { //already loaded, don't do anything error = OK; @@ -717,10 +717,10 @@ Error ResourceLoaderBinary::load() { if (cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE && ResourceCache::has(path)) { //use the existing one - Resource *r = ResourceCache::get(path); - if (r->get_class() == t) { - r->reset_state(); - res = Ref<Resource>(r); + Ref<Resource> cached = ResourceCache::get_ref(path); + if (cached->get_class() == t) { + cached->reset_state(); + res = cached; } } |