From Tim Moore, fix for race conditions in takeOrGenerate() methods
This commit is contained in:
@@ -749,14 +749,17 @@ GLBufferObject* GLBufferObjectSet::takeFromOrphans(BufferObject* bufferObject)
|
||||
|
||||
GLBufferObject* GLBufferObjectSet::takeOrGenerate(BufferObject* bufferObject)
|
||||
{
|
||||
// see if we can recyle GLBufferObject from the orphane list
|
||||
if (!_pendingOrphanedGLBufferObjects.empty())
|
||||
// see if we can recyle GLBufferObject from the orphan list
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
handlePendingOrphandedGLBufferObjects();
|
||||
return takeFromOrphans(bufferObject);
|
||||
if (!_pendingOrphanedGLBufferObjects.empty())
|
||||
{
|
||||
handlePendingOrphandedGLBufferObjects();
|
||||
return takeFromOrphans(bufferObject);
|
||||
}
|
||||
}
|
||||
else if (!_orphanedGLBufferObjects.empty())
|
||||
|
||||
if (!_orphanedGLBufferObjects.empty())
|
||||
{
|
||||
return takeFromOrphans(bufferObject);
|
||||
}
|
||||
|
||||
@@ -514,14 +514,17 @@ Texture::TextureObject* Texture::TextureObjectSet::takeFromOrphans(Texture* text
|
||||
|
||||
Texture::TextureObject* Texture::TextureObjectSet::takeOrGenerate(Texture* texture)
|
||||
{
|
||||
// see if we can recyle TextureObject from the orphane list
|
||||
if (!_pendingOrphanedTextureObjects.empty())
|
||||
// see if we can recyle TextureObject from the orphan list
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
handlePendingOrphandedTextureObjects();
|
||||
return takeFromOrphans(texture);
|
||||
if (!_pendingOrphanedTextureObjects.empty())
|
||||
{
|
||||
handlePendingOrphandedTextureObjects();
|
||||
return takeFromOrphans(texture);
|
||||
}
|
||||
}
|
||||
else if (!_orphanedTextureObjects.empty())
|
||||
|
||||
if (!_orphanedTextureObjects.empty())
|
||||
{
|
||||
return takeFromOrphans(texture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user