Fix for OptionMenu Crash
authorvipul <vipul.kumar@samsung.com>
Wed, 16 Oct 2013 07:26:54 +0000 (12:56 +0530)
committervipul <vipul.kumar@samsung.com>
Wed, 16 Oct 2013 07:30:02 +0000 (13:00 +0530)
Signed-off-by: vipul <vipul.kumar@samsung.com>
Change-Id: Ia48b9411f48ac9494d103f4df1508de4fdfb53f6

src/ui/controls/FUiCtrl_OptionMenu.cpp
src/ui/inc/FUiCtrl_OptionMenu.h

index 3e1b176..0585d94 100644 (file)
@@ -65,6 +65,7 @@ _OptionMenu::_OptionMenu(void)
        , __isFocused(false)
        , __currentFocusedIndex(-1)
        , __selectedActionID(-1)
+       , __isAnimating(false)
        , __pBoundsTimingFunction(null)
        , __pOpacityTimingFunction(null)
        , __windowRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
@@ -327,6 +328,11 @@ _OptionMenu::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
 bool
 _OptionMenu::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
 {
+       if (__isAnimating && GetVisualElement())
+       {
+               GetVisualElement()->RemoveAllAnimations();
+       }
+
        _KeyCode keyCode = keyInfo.GetKeyCode();
 
        if (keyCode ==  _KEY_ENTER && __isFocused)
@@ -364,6 +370,8 @@ _OptionMenu::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
 void
 _OptionMenu::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
 {
+       __isAnimating = false;
+
        if (keyName == L"ClosingOpacityAnimation")
        {
                SetVisibleState(false);
@@ -1435,6 +1443,8 @@ _OptionMenu::OpenAnimation()
        pVisualElement->AddAnimation(L"OpeningBoundsAnimation", *pBoundsAnimation);
        pVisualElement->AddAnimation(L"OpeningOpacityAnimation", *pOpacityAnimation);
 
+       __isAnimating = true;
+
        delete pBoundsAnimation;
 
        delete pOpacityAnimation;
@@ -1520,6 +1530,8 @@ _OptionMenu::CloseAnimation(int actionId)
        pVisualElement->AddAnimation(L"ClosingBoundsAnimation", *pBoundsAnimation);
        pVisualElement->AddAnimation(L"ClosingOpacityAnimation", *pOpacityAnimation);
 
+       __isAnimating = true;
+
        delete pBoundsAnimation;
        delete pOpacityAnimation;
 
@@ -1570,6 +1582,11 @@ _OptionMenu::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& to
 bool
 _OptionMenu::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
 {
+       if (__isAnimating && GetVisualElement())
+       {
+               GetVisualElement()->RemoveAllAnimations();
+       }
+
        return __pOptionMenuPresenter->OnTouchReleased(source, touchinfo);
 }
 
index 5a50227..351c071 100644 (file)
@@ -242,6 +242,7 @@ private:
        bool __isFocused;
        int __currentFocusedIndex;
        int __selectedActionID;
+       bool __isAnimating;
 
        static const int ANIMATION_DURATION = 333;