diff --git a/src/osg/BufferObject.cpp b/src/osg/BufferObject.cpp index 1b8c97678..798333d71 100644 --- a/src/osg/BufferObject.cpp +++ b/src/osg/BufferObject.cpp @@ -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 lock(_mutex); - handlePendingOrphandedGLBufferObjects(); - return takeFromOrphans(bufferObject); + if (!_pendingOrphanedGLBufferObjects.empty()) + { + handlePendingOrphandedGLBufferObjects(); + return takeFromOrphans(bufferObject); + } } - else if (!_orphanedGLBufferObjects.empty()) + + if (!_orphanedGLBufferObjects.empty()) { return takeFromOrphans(bufferObject); } diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 641553d50..526bed599 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -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 lock(_mutex); - handlePendingOrphandedTextureObjects(); - return takeFromOrphans(texture); + if (!_pendingOrphanedTextureObjects.empty()) + { + handlePendingOrphandedTextureObjects(); + return takeFromOrphans(texture); + } } - else if (!_orphanedTextureObjects.empty()) + + if (!_orphanedTextureObjects.empty()) { return takeFromOrphans(texture); }