mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-27 19:30:54 +00:00
Fixed: #620 Incorrect usage of mutex in particle system loader
This commit is contained in:
parent
90d86ba2d8
commit
ec525fe7a9
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