[2.2.1] Merge different codes between 2.2 and 3.0
[platform/framework/native/appfw.git] / src / base / inc / FBase_ObjectManagerImpl.h
old mode 100755 (executable)
new mode 100644 (file)
index 5da1ad5..362c451
@@ -20,8 +20,6 @@
  *
  * This file contains the declarations of the %_ObjectManagerImpl class.
  */
-
-
 #ifndef _FBASE_INTERNAL_OBJECT_MANAGER_IMPL_H_
 #define _FBASE_INTERNAL_OBJECT_MANAGER_IMPL_H_
 
@@ -30,7 +28,6 @@
 #include <FBaseRtMutex.h>
 #include <FBaseSysLog.h>
 
-
 namespace Tizen { namespace Base
 {
 
@@ -66,7 +63,7 @@ public:
        virtual ~_ObjectManagerImpl(void)
        {
                delete[] __pSlots;
-               delete __pLock;
+               //delete __pLock;
        }
 
        /**
@@ -74,15 +71,15 @@ public:
         *
         * @since 2.0
         */
-       _ObjectManagerImpl(_ObjectManagerImpl& pObjectManagerImpl)
+       _ObjectManagerImpl(_ObjectManagerImpl& objectManagerImpl)
        {
-               __slotCount = pObjectManagerImpl.__slotCount;
-               __slotCapacity = pObjectManagerImpl.__slotCapacity;
-               __pSlots = new _HandleElement[pObjectManagerImpl.__slotCapacity];
+               __slotCount = objectManagerImpl.__slotCount;
+               __slotCapacity = objectManagerImpl.__slotCapacity;
+               __pSlots = new _HandleElement[objectManagerImpl.__slotCapacity];
 
-               for (unsigned int i = 0; i < pObjectManagerImpl.__slotCapacity; i++)
+               for (unsigned int i = 0; i < objectManagerImpl.__slotCapacity; i++)
                {
-                       __pSlots[i] = pObjectManagerImpl.__pSlots[i];
+                       __pSlots[i] = objectManagerImpl.__pSlots[i];
                }
 
                __pLock = new (std::nothrow) Tizen::Base::Runtime::Mutex();
@@ -190,6 +187,9 @@ public:
 
                if (index >= __slotCount)
                {
+                       r = __pLock->Release();
+                       SysTryLog(NID_BASE, !IsFailed(r), "Failed to release mutex");
+
                        SetLastResult(E_OBJ_NOT_FOUND);
                        return null;
                }
@@ -197,6 +197,9 @@ public:
                _HandleElement& element = __pSlots[index];
                if (element.__id != ((_Handle*)&handle)->__id)
                {
+                       r = __pLock->Release();
+                       SysTryLog(NID_BASE, !IsFailed(r), "Failed to release mutex");
+
                        SetLastResult(E_OBJ_NOT_FOUND);
                        return null;
                }
@@ -214,7 +217,6 @@ public:
                return pObject;
        }
 
-
        /**
         * Gets an object specified by the handle.
         *
@@ -233,6 +235,9 @@ public:
 
                if (index >= __slotCount)
                {
+                       r = __pLock->Release();
+                       SysTryLog(NID_BASE, !IsFailed(r), "Failed to release mutex");
+
                        SetLastResult(E_OBJ_NOT_FOUND);
                        return null;
                }
@@ -240,6 +245,9 @@ public:
                const _HandleElement& element = __pSlots[index];
                if (element.__id != ((_Handle*)&handle)->__id)
                {
+                       r = __pLock->Release();
+                       SysTryLog(NID_BASE, !IsFailed(r), "Failed to release mutex");
+
                        SetLastResult(E_OBJ_NOT_FOUND);
                        return null;
                }
@@ -265,7 +273,6 @@ public:
                return const_cast<void*>(pObj);
        }
 
-
        /**
         * Gets the number of objects in the object manager.
         *
@@ -330,7 +337,6 @@ private:
 
        void SetElementAt(int index)
        {
-
        }
 
        _HandleElement GetElementAt(int index)
@@ -400,7 +406,5 @@ private:
        Tizen::Base::Runtime::Mutex* __pLock;
 
 };
-
 }} // Tizen::Base
-
-#endif // _FBASE_INTERNAL_OBJECT_MANAGER_IMPL_H_
+#endif // _FBASE_INTERNAL_OBJECT_MANAGER_IMPL_H_
\ No newline at end of file