Some resources are freed before they are saved

- PackedScenes freed before saved, so their path cache is lost
 - Solution is to move data to persistent static map
 - This patch will fix #30538
This commit is contained in:
Cameron Reikes
2019-07-16 09:46:40 -07:00
parent d483a85a0f
commit b3cb58e7b3
2 changed files with 40 additions and 8 deletions

View File

@ -88,9 +88,7 @@ protected:
void _set_path(const String &p_path);
void _take_over_path(const String &p_path);
#ifdef TOOLS_ENABLED
Map<String, int> id_for_path;
#endif
public:
static Node *(*_get_local_scene_func)(); //used by editor
@ -156,6 +154,10 @@ class ResourceCache {
friend class ResourceLoader; //need the lock
static RWLock *lock;
static HashMap<String, Resource *> resources;
#ifdef TOOLS_ENABLED
static HashMap<String, HashMap<String, int> > resource_path_cache; // each tscn has a set of resource paths and IDs
static RWLock *path_cache_lock;
#endif // TOOLS_ENABLED
friend void unregister_core_types();
static void clear();
friend void register_core_types();