From 5edadf14331be32dd276fa156e9e6c55a4f0d978 Mon Sep 17 00:00:00 2001 From: janwas Date: Sat, 14 Aug 2004 12:36:03 +0000 Subject: [PATCH] don't cache handles that don't have a key (i.e. couldn't be found when reloading) This was SVN commit r991. --- source/lib/res/h_mgr.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/lib/res/h_mgr.cpp b/source/lib/res/h_mgr.cpp index 59afb5ccce..94dc52db3b 100755 --- a/source/lib/res/h_mgr.cpp +++ b/source/lib/res/h_mgr.cpp @@ -424,8 +424,6 @@ Handle h_alloc(H_Type type, const char* fn, uint flags, ...) i32 idx; HDATA* hd; - const uint scope = flags & RES_SCOPE_MASK; - // get key (either hash of filename, or fn param) uintptr_t key = 0; // not backed by file; fn is the key @@ -440,6 +438,12 @@ Handle h_alloc(H_Type type, const char* fn, uint flags, ...) key = fnv_hash(fn); } + // disable caching if no key, because it would never be found + if(!key) + flags |= RES_NO_CACHE; // changes scope to RES_TEMP + + const uint scope = flags & RES_SCOPE_MASK; + if(key) { // object already loaded?