modify memory leak, modify mouse Key(KEY_OEM_2->KEY_BACK) for polaris office app
authorminkyu kim <imetjade.kim@samsung.com>
Wed, 7 Aug 2013 11:28:01 +0000 (20:28 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Wed, 7 Aug 2013 11:28:01 +0000 (20:28 +0900)
Change-Id: I8b97cf59ad1e213d651a3e0697961903b0c7c40c

src/ui/FUi_ControlImpl.cpp
src/ui/FUi_EflUiEventManager.cpp

index 2e582d6..dad33b6 100644 (file)
@@ -1442,28 +1442,28 @@ public:
 
                        const _ControlHandle controlHandle = pControlImpl->GetCore().GetHandle();
 
-                               TouchEventInfo publicTouchInfo;
+                       TouchEventInfo publicTouchInfo;
 
-                               _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
                        SysTryReturn(NID_UI, pEventArg, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
 
-                               publicTouchInfo.Construct(*pEventArg);
+                       publicTouchInfo.Construct(*pEventArg);
 
-                               if (pEventArg)
-                               {
-                                       delete pEventArg;
-                                       pEventArg = null;
-                               }
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
 
                        isFiltered = __impl.__pPublicPropagatedTouchEventListener->OnTouchMoved(control, publicTouchInfo);
-                               if (isFiltered)
-                               {
-                                       return true;
-                               }
+                       if (isFiltered)
+                       {
+                               return true;
+                       }
 
                        _Control* pControl = _ControlManager::GetInstance()->GetObject(controlHandle);
                        SysTryReturn(NID_UI, pControl, true, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Target control is deleted.");
-                       }
+               }
 
                return __impl.CallOnTouchMoved(source, touchInfo);
        }
@@ -1481,28 +1481,28 @@ public:
 
                        const _ControlHandle controlHandle = pControlImpl->GetCore().GetHandle();
 
-                               TouchEventInfo publicTouchInfo;
+                       TouchEventInfo publicTouchInfo;
 
-                               _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
                        SysTryReturn(NID_UI, pEventArg, false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
 
-                               publicTouchInfo.Construct(*pEventArg);
+                       publicTouchInfo.Construct(*pEventArg);
 
-                               if (pEventArg)
-                               {
-                                       delete pEventArg;
-                                       pEventArg = null;
-                               }
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
 
                        isFiltered = __impl.__pPublicPropagatedTouchEventListener->OnTouchCanceled(control, publicTouchInfo);
-                               if (isFiltered)
-                               {
-                                       return true;
-                               }
+                       if (isFiltered)
+                       {
+                               return true;
+                       }
 
                        _Control* pControl = _ControlManager::GetInstance()->GetObject(controlHandle);
                        SysTryReturn(NID_UI, pControl, true, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Target control is deleted.");
-                       }
+               }
 
                return __impl.CallOnTouchCanceled(source, touchInfo);
        }
@@ -1858,14 +1858,13 @@ public:
 
                        Control& control = static_cast<Control&>(pControlImpl->GetPublic());
 
-                       KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
-                               static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
+                       KeyEventInfo keyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()), static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
 
-                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->TranslateKeyEventInfo(control, *pKeyEventInfo);
+                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->TranslateKeyEventInfo(control, keyEventInfo);
                        if (isFiltered)
                        {
-                               keyInfo.SetKeyCode(static_cast<_KeyCode>(pKeyEventInfo->GetKeyCode()));
-                               keyInfo.SetKeyModifier(static_cast<_KeyModifier>(pKeyEventInfo->GetKeyModifier()));
+                               keyInfo.SetKeyCode(static_cast<_KeyCode>(keyEventInfo.GetKeyCode()));
+                               keyInfo.SetKeyModifier(static_cast<_KeyModifier>(keyEventInfo.GetKeyModifier()));
                                return true;
                        }
                }
@@ -1889,8 +1888,6 @@ public:
 
                bool isFiltered = false;
 
-               //SysLog(NID_UI, ">>> [impl.1] OnKeyPressed(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
-
                if (__impl.__pPublicPropagatedKeyEventListener != null)
                {
                        _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(source.GetUserData());
@@ -1912,19 +1909,14 @@ public:
 
                        Control& control = static_cast<Control&>(pControlImpl->GetPublic());
 
-                               KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
-                                       static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
-
-                               //SysLog(NID_UI, ">>> [impl.2] OnKeyPressed(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
+                       KeyEventInfo keyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()), static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
 
-                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnKeyPressed(control, *pKeyEventInfo);
-                               if (isFiltered)
-                               {
-                                       return true;
-                               }
+                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnKeyPressed(control, keyEventInfo);
+                       if (isFiltered)
+                       {
+                               return true;
                        }
-
-               //SysLog(NID_UI, ">>> [impl.3] OnKeyPressed(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
+               }
 
                if (&source == &__core)
                {
@@ -1970,8 +1962,6 @@ public:
 
                bool isFiltered = false;
 
-               //SysLog(NID_UI, ">>> [impl.1] OnKeyReleased(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
-
                if (__impl.__pPublicPropagatedKeyEventListener != null)
                {
                        _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(source.GetUserData());
@@ -1993,19 +1983,14 @@ public:
 
                        Control& control = static_cast<Control&>(pControlImpl->GetPublic());
 
-                               KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
-                                       static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
-
-                               //SysLog(NID_UI, ">>> [impl.2] OnKeyReleased(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
+                       KeyEventInfo keyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()), static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
 
-                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnKeyReleased(control, *pKeyEventInfo);
-                               if (isFiltered)
-                               {
-                                       return true;
-                               }
+                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnKeyReleased(control, keyEventInfo);
+                       if (isFiltered)
+                       {
+                               return true;
                        }
-
-               //SysLog(NID_UI, ">>> [impl.3] OnKeyReleased(%d, %d)", keyInfo.GetKeyCode(), keyInfo.GetKeyModifier());
+               }
 
                if (&source == &__core)
                {
@@ -2064,10 +2049,9 @@ public:
 
                        Control& control = static_cast<Control&>(pControlImpl->GetPublic());
 
-                       KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
-                               static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
+                       KeyEventInfo keyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()), static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
 
-                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnPreviewKeyPressed(control, *pKeyEventInfo);
+                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnPreviewKeyPressed(control, keyEventInfo);
                        if (isFiltered)
                        {
                                return true;
@@ -2112,10 +2096,9 @@ public:
 
                        Control& control = static_cast<Control&>(pControlImpl->GetPublic());
 
-                       KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
-                               static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
+                       KeyEventInfo keyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()), static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
 
-                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnPreviewKeyReleased(control, *pKeyEventInfo);
+                       isFiltered = __impl.__pPublicPropagatedKeyEventListener->OnPreviewKeyReleased(control, keyEventInfo);
                        if (isFiltered)
                        {
                                return true;
index a612ce8..b6c0b38 100644 (file)
@@ -1342,36 +1342,36 @@ OnTouchPressed(void* pData __UNUSED__, int type __UNUSED__, void* pEventInfo)
 
        if (pEv->buttons == _MOUSE_BUTTON_LEFT || pEv->buttons == _MOUSE_BUTTON_NONE)
        {
-       _TouchEvent event(pEv->multi.device, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, pEv->timestamp, null);
+               _TouchEvent event(pEv->multi.device, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, pEv->timestamp, null);
 
-       result r = GetLastResult();
-       if (r != E_SUCCESS)
-       {
-               SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
-               return ECORE_CALLBACK_PASS_ON;
-       }
+               result r = GetLastResult();
+               if (r != E_SUCCESS)
+               {
+                       SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
+                       return ECORE_CALLBACK_PASS_ON;
+               }
 
-       event.Send();
+               event.Send();
        }
        else
        {
                //_MouseEvent event(pEv->multi.device, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, 0, pEv->buttons, pEv->timestamp, null);
                _MouseEvent event(pEv->multi.device, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, 0, _MOUSE_BUTTON_RIGHT, pEv->timestamp, null);
 
-       result r = GetLastResult();
-       if (r != E_SUCCESS)
-       {
-               SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
-               return ECORE_CALLBACK_PASS_ON;
-       }
+               result r = GetLastResult();
+               if (r != E_SUCCESS)
+               {
+                       SysLog(NID_UI, "[%s] Propagating.", GetErrorMessage(r));
+                       return ECORE_CALLBACK_PASS_ON;
+               }
 
-       event.Send();
+               event.Send();
 
                _UiEventManager* pEventManager = _UiEventManager::GetInstance();
                SysTryReturn(NID_UI, pEventManager, ECORE_CALLBACK_PASS_ON, E_SYSTEM, "[E_SYSTEM] System error occurred.");
 
-               pEventManager->GenerateKeyEvent(KEY_PRESSED, _KEY_OEM_2, _KEY_MODIFIER_NONE, false);
-               pEventManager->GenerateKeyEvent(KEY_RELEASED, _KEY_OEM_2, _KEY_MODIFIER_NONE, false);
+               pEventManager->GenerateKeyEvent(KEY_PRESSED, _KEY_BACK, _KEY_MODIFIER_NONE, false);
+               pEventManager->GenerateKeyEvent(KEY_RELEASED, _KEY_BACK, _KEY_MODIFIER_NONE, false);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1410,7 +1410,6 @@ OnTouchReleased(void* pData __UNUSED__, int type __UNUSED__, void* pEventInfo)
                //_MouseEvent event(pEv->multi.device, _TOUCH_RELEASED, pEv->root.x, pEv->root.y, 0, pEv->buttons, pEv->timestamp, null);
                _MouseEvent event(pEv->multi.device, _TOUCH_RELEASED, pEv->root.x, pEv->root.y, 0, _MOUSE_BUTTON_RIGHT, pEv->timestamp, null);
 
-
                result r = GetLastResult();
                if (r!= E_SUCCESS)
                {