mirror of
https://github.com/Relintai/props.git
synced 2024-11-12 10:15:25 +01:00
Added a mutex to ensure_materials_loaded in PropCache. This fixes potential "ERROR: Another resource is loaded from path" when spawning lots of PropInstanceMergers for the first time.
This commit is contained in:
parent
a0153bbe0b
commit
4be30142fb
@ -41,8 +41,8 @@ SOFTWARE.
|
||||
#include "../../thread_pool/thread_pool.h"
|
||||
#endif
|
||||
|
||||
#include "../tiled_wall/tiled_wall_data.h"
|
||||
#include "../material_cache/prop_material_cache.h"
|
||||
#include "../tiled_wall/tiled_wall_data.h"
|
||||
|
||||
#include "core/hashfuncs.h"
|
||||
|
||||
@ -170,9 +170,13 @@ void PropCache::materials_load() {
|
||||
}
|
||||
|
||||
void PropCache::ensure_materials_loaded() {
|
||||
_material_mutex.lock();
|
||||
|
||||
if (_materials.size() != _material_paths.size()) {
|
||||
materials_load();
|
||||
}
|
||||
|
||||
_material_mutex.unlock();
|
||||
}
|
||||
|
||||
Vector<Variant> PropCache::materials_get() {
|
||||
|
@ -122,6 +122,8 @@ protected:
|
||||
Mutex _tiled_wall_material_cache_mutex;
|
||||
Mutex _custom_keyed_material_cache_mutex;
|
||||
|
||||
Mutex _material_mutex;
|
||||
|
||||
#ifdef TEXTURE_PACKER_PRESENT
|
||||
int _texture_flags;
|
||||
int _max_atlas_size;
|
||||
|
Loading…
Reference in New Issue
Block a user