forked from teamnwah/openmw-tes3coop
Add missing lock in shareMaterial
This commit is contained in:
parent
34deb6e7b1
commit
e399e10607
1 changed files with 6 additions and 4 deletions
|
@ -1643,10 +1643,12 @@ namespace NifOsg
|
||||||
osg::Material* shareMaterial(osg::Material* mat)
|
osg::Material* shareMaterial(osg::Material* mat)
|
||||||
{
|
{
|
||||||
typedef std::set<osg::ref_ptr<osg::Material>, CompareMaterial> MatCache;
|
typedef std::set<osg::ref_ptr<osg::Material>, CompareMaterial> MatCache;
|
||||||
static MatCache mats;
|
static MatCache sMats;
|
||||||
MatCache::iterator found = mats.find(mat);
|
static OpenThreads::Mutex sMutex;
|
||||||
if (found == mats.end())
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(sMutex);
|
||||||
found = mats.insert(mat).first;
|
MatCache::iterator found = sMats.find(mat);
|
||||||
|
if (found == sMats.end())
|
||||||
|
found = sMats.insert(mat).first;
|
||||||
return *found;
|
return *found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue