mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Fixed: #620 Incorrect usage of mutex in particle system loader
This commit is contained in:
parent
a64e68cf91
commit
c2de0eeb31
1 changed files with 9 additions and 7 deletions
|
@ -39,7 +39,11 @@ namespace NL3D {
|
|||
using NLMISC::CIFile;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
NLMISC::CMutex s_PSSMutex;
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
// private usage : macro to check the memory integrity
|
||||
#if defined(NL_DEBUG) && defined(NL_OS_WINDOWS)
|
||||
|
@ -220,9 +224,8 @@ CParticleSystem *CParticleSystemShape::instanciatePS(CScene &scene, NLMISC::CCon
|
|||
return _SharedSystem;
|
||||
}
|
||||
|
||||
// avoid prb with concurent thread (may append if an instance group containing ps is loaded in background)
|
||||
NLMISC::CMutex mutex;
|
||||
mutex.enter();
|
||||
// avoid prb with concurrent thread (may happen if an instance group containing ps is loaded in background)
|
||||
s_PSSMutex.enter();
|
||||
|
||||
|
||||
#ifdef PS_FAST_ALLOC
|
||||
|
@ -295,7 +298,7 @@ CParticleSystem *CParticleSystemShape::instanciatePS(CScene &scene, NLMISC::CCon
|
|||
}
|
||||
#endif
|
||||
|
||||
mutex.leave();
|
||||
s_PSSMutex.leave();
|
||||
|
||||
/*NLMISC::TTicks end = NLMISC::CTime::getPerformanceTime();
|
||||
nlinfo("instanciation time = %.2f", (float) (1000 * NLMISC::CTime::ticksToSecond(end - start))); */
|
||||
|
@ -390,8 +393,7 @@ void CParticleSystemShape::flushTextures(IDriver &driver, uint selectedTexture)
|
|||
}
|
||||
else
|
||||
{
|
||||
NLMISC::CMutex mutex;
|
||||
mutex.enter();
|
||||
s_PSSMutex.enter();
|
||||
|
||||
// must create an instance just to flush the textures
|
||||
CParticleSystem *myInstance = NULL;
|
||||
|
@ -436,7 +438,7 @@ void CParticleSystemShape::flushTextures(IDriver &driver, uint selectedTexture)
|
|||
#ifdef PS_FAST_ALLOC
|
||||
PSBlockAllocator = NULL;
|
||||
#endif
|
||||
mutex.leave();
|
||||
s_PSSMutex.leave();
|
||||
}
|
||||
for(uint k = 0; k < _CachedTex.size(); ++k)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue