Fix for Prevent issues
authorPrakalathan Ponnusamy <prakalath.p@samsung.com>
Thu, 27 Jun 2013 14:02:34 +0000 (19:32 +0530)
committerPrakalathan Ponnusamy <prakalath.p@samsung.com>
Fri, 28 Jun 2013 12:28:09 +0000 (17:58 +0530)
Change-Id: I8ae15b23a5de395aac95c44957c4a4775004e604

src/ui/controls/FUiCtrl_ContextMenuGridPresenter.cpp
src/ui/controls/FUiCtrl_ContextMenuListPresenter.cpp
src/ui/controls/FUiCtrl_DateTimeBar.cpp
src/ui/controls/FUiCtrl_IconListItem.cpp
src/ui/controls/FUiCtrl_ListViewItem.cpp
src/ui/controls/FUiCtrl_SliderPresenter.cpp
src/ui/controls/FUiCtrl_TableViewItem.cpp

index 0e56790..89a8725 100644 (file)
@@ -1700,8 +1700,11 @@ _ContextMenuGridPresenter::OnKeyPressed(const _Control& source, const _KeyInfo&
 
                __selectedIndex = __focusedIndex;
                _ContextMenuItem* pItem = __pModel->GetItem(__focusedIndex);
-               pItem->SetFocused(true);
-               Draw();
+               if (pItem != null)
+               {
+                       pItem->SetFocused(true);
+                       Draw();
+               }
 
                break;
        }
index b98af3a..c2e4a61 100644 (file)
@@ -326,15 +326,21 @@ _ContextMenuListPresenter::SetItem(int index, const Tizen::Base::String& text, i
                                                                   const Tizen::Graphics::Bitmap* normalBitmap, const Tizen::Graphics::Bitmap* pPressedBitmap,
                                                                   const Tizen::Graphics::Bitmap* pHighlightedBitmap)
 {
+       _ContextMenuItem* pItem = null;
+       result r = E_SUCCESS;
+
        if (text.GetLength() == 0 && normalBitmap == null && pPressedBitmap == null)
        {
                return E_INVALID_ARG;
        }
 
-       result r = __pContextMenu->GetScrollPanel()->DetachChild(*__pModel->GetItem(index));
+       pItem = __pModel->GetItem(index);
+       r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, pItem != null, r, r, "Failed to get the item.");
+
+       r = __pContextMenu->GetScrollPanel()->DetachChild(*pItem);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item.");
 
-       _ContextMenuItem* pItem = null;
        pItem = CreateItem(text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap);
        SysTryReturn(NID_UI_CTRL, pItem != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
@@ -351,13 +357,20 @@ _ContextMenuListPresenter::SetItem(int index, const Tizen::Base::String& text, i
 result
 _ContextMenuListPresenter::DeleteItem(int index)
 {
+       _ContextMenuItem* pItem = null;
+       result r = E_SUCCESS;
+
        if (__pContextMenu->GetItemCount() <= 0)
        {
                SysLogException(NID_UI_CTRL, E_INVALID_STATE, "Invalid argument.");
                return E_INVALID_STATE;
        }
 
-       result r = __pContextMenu->GetScrollPanel()->DetachChild(*__pModel->GetItem(index));
+       pItem = __pModel->GetItem(index);
+       r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, pItem != null, r, r, "Failed to get the item.");
+
+       r = __pContextMenu->GetScrollPanel()->DetachChild(*pItem);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to detach item.");
 
        r = __pModel->RemoveItem(index);
@@ -1013,6 +1026,10 @@ _ContextMenuListPresenter::OnTouchReleased(const _Control& source, const _TouchI
        {
                _ContextMenuItem* pItem = null;
                pItem = __pModel->GetItem(__selectedIndex);
+               if (pItem == null)
+               {
+                       return true;
+               }
 
                __selectedIndex = -1;
                __focusedIndex = -1;
index db9c642..912a6e6 100644 (file)
@@ -508,9 +508,8 @@ _DateTimeBar::RemoveAccessibilityElementAt(int index)
        SysTryReturnVoidResult(NID_UI_CTRL, (pContainer != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        _AccessibilityElement* pAccessibilityElement = null;
-       __accessibilityElements.GetAt(index, pAccessibilityElement);
 
-       if (pAccessibilityElement != null)
+       if (__accessibilityElements.GetAt(index, pAccessibilityElement) == E_SUCCESS)
        {
                __accessibilityElements.RemoveAt(index);
                pContainer->RemoveElement(*pAccessibilityElement);
index d033206..96479e2 100644 (file)
@@ -1051,7 +1051,7 @@ _IconListItem::SetItemAccessibilityElement(FloatRectangle& rect, int itemIndex,
                __pAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_IMAGE");
        }
 
-       if (__pAccessibilityElement != null && itemIndex >= 0)
+       if (itemIndex >= 0)
        {
                if (swapElement)
                {
index 0c951cb..7ab3984 100644 (file)
@@ -229,6 +229,8 @@ _ListViewItem::AddElement(FloatRectangle& rect, int elementId, const EnrichedTex
 
        // Set Visual element for this element
        _VisualElement* pVE = new (std::nothrow) _VisualElement();
+       SysTryReturn(NID_UI_CTRL, (pVE != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
        pVE->Construct();
        pVE->SetImplicitAnimationEnabled(false);
        pVE->SetContentProvider(&__hitTestVEDelegator);
@@ -283,6 +285,8 @@ _ListViewItem::AddElement(FloatRectangle& rect, int elementId, const Bitmap* pNo
        element.pBitmapElement->pBitmap[LISTVIEW_ITEM_STATUS_HIGHLIGHTED] = pCloneHighlightedBitmap;
 
        pVE = new (std::nothrow) _VisualElement();
+       SysTryCatch(NID_UI_CTRL, pVE, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
        pVE->Construct();
        pVE->SetImplicitAnimationEnabled(false);
        pVE->SetContentProvider(&__hitTestVEDelegator);
@@ -322,6 +326,7 @@ _ListViewItem::AddElement(FloatRectangle& rect, int elementId, const _ICustomEle
        element.pCustomElement->pCustom = const_cast<_ICustomElement*>(pCustom);
 
        _VisualElement* pVE = new (std::nothrow) _VisualElement();
+       SysTryReturn(NID_UI_CTRL, (pVE != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
        pVE->Construct();
        pVE->SetImplicitAnimationEnabled(false);
        pVE->SetContentProvider(&__hitTestVEDelegator);
index 4932e6d..83e125e 100644 (file)
@@ -388,7 +388,6 @@ _SliderPresenter::LoadBitmap(void)
        result r = E_SUCCESS;
 
        int opacity = 0;
-       Bitmap* pBitmap = null;
        Bitmap* pNormalBitmap = null;
        Bitmap* pPressedBitmap = null;
        Bitmap* pDisabledBitmap = null;
@@ -564,34 +563,26 @@ _SliderPresenter::LoadBitmap(void)
 
        if (__pHandleNormalEffectBitmap == null)
        {
-               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandleNormalEffectBitmap);
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pHandleNormalEffectBitmap = pBitmap;
        }
 
        if (__pHandlePressedEffectBitmap == null)
        {
-               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlePressedEffectBitmap);
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pHandlePressedEffectBitmap = pBitmap;
        }
 
        if (__pHandleDisabledEffectBitmap == null)
        {
-               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandleDisabledEffectBitmap);
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pHandleDisabledEffectBitmap = pBitmap;
        }
 
        if (__pHandleHighlightedEffectBitmap == null)
        {
-               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
+               r = GET_BITMAP_CONFIG_N(SLIDER::HANDLE_BG_EFFECT_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandleHighlightedEffectBitmap);
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pHandleHighlightedEffectBitmap = pBitmap;
        }
 
        delete pNormalBitmap;
@@ -608,8 +599,6 @@ CATCH:
        delete pDisabledBitmap;
        delete pHighlightedBitmap;
 
-       delete pBitmap;
-
        delete __pResourceBgTopBitmap;
        __pResourceBgTopBitmap = null;
 
index 90f50c5..d92266d 100644 (file)
@@ -4681,11 +4681,6 @@ _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
        switch (keyCode)
        {
        case _KEY_LEFT:
-               if (pFocusList == null)
-               {
-                       break;
-               }
-
                if (IsFocused())
                {
                        if (pChildControl == null)
@@ -4757,11 +4752,6 @@ _TableViewItem::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
                break;
 
        case _KEY_RIGHT:
-               if (pFocusList == null)
-               {
-                       break;
-               }
-
                if (IsFocused())
                {
                        if (pChildControl == null)