Bug fix FixedSizeMemoryPool 99/54899/1
authorFerran Sole <ferran.sole@samsung.com>
Fri, 18 Dec 2015 11:49:03 +0000 (11:49 +0000)
committerFerran Sole <ferran.sole@samsung.com>
Fri, 18 Dec 2015 11:49:03 +0000 (11:49 +0000)
Change-Id: Ie94f52f2f4cee7bad19bb83025b1a059e13df39e

dali/internal/common/fixed-size-memory-pool.cpp

index 0594639..63e3f4b 100644 (file)
@@ -151,8 +151,6 @@ FixedSizeMemoryPool::~FixedSizeMemoryPool()
 
 void* FixedSizeMemoryPool::Allocate()
 {
-  Mutex::ScopedLock( mImpl->mMutex );
-
   // First, recycle deleted objects
   if( mImpl->mDeletedObjects )
   {
@@ -177,8 +175,6 @@ void* FixedSizeMemoryPool::Allocate()
 
 void FixedSizeMemoryPool::Free( void* memory )
 {
-  Mutex::ScopedLock( mImpl->mMutex );
-
   // Add memory to head of deleted objects list. Store next address in the same memory space as the old object.
   *( reinterpret_cast< void** >( memory ) ) = mImpl->mDeletedObjects;
   mImpl->mDeletedObjects = memory;
@@ -186,13 +182,13 @@ void FixedSizeMemoryPool::Free( void* memory )
 
 void* FixedSizeMemoryPool::AllocateThreadSafe()
 {
-  Mutex::ScopedLock( mImpl->mMutex );
+  Mutex::ScopedLock lock( mImpl->mMutex );
   return Allocate();
 }
 
 void FixedSizeMemoryPool::FreeThreadSafe( void* memory )
 {
-  Mutex::ScopedLock( mImpl->mMutex );
+  Mutex::ScopedLock lock( mImpl->mMutex );
   Free( memory );
 }