From 41ce2dd5bb77f2d7f9fca4c8e2530a65a2dc58a1 Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Tue, 1 Aug 2017 17:00:36 +0900 Subject: [PATCH] [3.0] Fix SVACE issues - Indicator::OnPan() code is unreachable because of 'return;' in ecore-indicator-impl - Pointer 'info' returned from function 'malloc' at key-grab-ecore-wl may be null Change-Id: I00e09c05319485e26a89b5d2658d9c82c7e0c42b Signed-off-by: Seoyeon Kim --- adaptors/ecore/common/ecore-indicator-impl.cpp | 53 +------------------------- adaptors/ecore/wayland/key-grab-ecore-wl.cpp | 50 +++++++++++++----------- adaptors/tizen/ecore-indicator-impl-tizen.cpp | 53 +------------------------- 3 files changed, 30 insertions(+), 126 deletions(-) diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index 6eaefb9..43363fb 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -1568,58 +1568,7 @@ void Indicator::OnAnimationFinished(Dali::Animation& animation) void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) { - return ; - - if( mServerConnection ) - { - switch( gesture.state ) - { - case Gesture::Started: - { - mGestureDetected = false; - - // The gesture position is the current position after it has moved by the displacement. - // We want to reference the original position. - mGestureDeltaY = gesture.position.y - gesture.displacement.y; - } - - // No break, Fall through - case Gesture::Continuing: - { - if( mVisible == Dali::Window::AUTO && !mIsShowing ) - { - // Only take one touch point - if( gesture.numberOfTouches == 1 && mGestureDetected == false ) - { - mGestureDeltaY += gesture.displacement.y; - - if( mGestureDeltaY >= mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE ) - { - ShowIndicator( AUTO_INDICATOR_STAY_DURATION ); - mGestureDetected = true; - } - } - } - - break; - } - - case Gesture::Finished: - case Gesture::Cancelled: - { - // if indicator is showing, hide again when touching is finished (Since touch leave is activated, checking it in gesture::finish instead of touch::up) - if( mVisible == Dali::Window::AUTO && mIsShowing ) - { - ShowIndicator( AUTO_INDICATOR_STAY_DURATION ); - } - break; - } - - - default: - break; - } - } + // Nothing to do, but we still want to consume pan } void Indicator::OnStageTouched(const Dali::TouchData& touchData) diff --git a/adaptors/ecore/wayland/key-grab-ecore-wl.cpp b/adaptors/ecore/wayland/key-grab-ecore-wl.cpp index 85f92c3..5d46e7b 100755 --- a/adaptors/ecore/wayland/key-grab-ecore-wl.cpp +++ b/adaptors/ecore/wayland/key-grab-ecore-wl.cpp @@ -99,28 +99,31 @@ Dali::Vector GrabKeyList( Window window, const Dali::Vector& da for( Dali::Vector::SizeType index = 0; index < keyCount; ++index ) { Ecore_Wl_Window_Keygrab_Info *info = (Ecore_Wl_Window_Keygrab_Info*)malloc(sizeof(Ecore_Wl_Window_Keygrab_Info)); - info->key = (char*)Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ); - - switch(grabModeVector[index]) + if( info ) { - case TOPMOST: - info->mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST; - break; - case SHARED: - info->mode = ECORE_WL_WINDOW_KEYGRAB_SHARED; - break; - case OVERRIDE_EXCLUSIVE: - info->mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE; - break; - case EXCLUSIVE: - info->mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE; - break; - default: - info->mode = ECORE_WL_WINDOW_KEYGRAB_UNKNOWN; - break; - } + info->key = (char*)Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ); + + switch(grabModeVector[index]) + { + case TOPMOST: + info->mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST; + break; + case SHARED: + info->mode = ECORE_WL_WINDOW_KEYGRAB_SHARED; + break; + case OVERRIDE_EXCLUSIVE: + info->mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE; + break; + case EXCLUSIVE: + info->mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE; + break; + default: + info->mode = ECORE_WL_WINDOW_KEYGRAB_UNKNOWN; + break; + } - keyList = eina_list_append(keyList, info); + keyList = eina_list_append(keyList, info); + } } grabList = ecore_wl_window_keygrab_list_set(AnyCast( window.GetNativeHandle() ), keyList); @@ -168,8 +171,11 @@ Dali::Vector UngrabKeyList( Window window, const Dali::Vector& for( Dali::Vector::SizeType index = 0; index < keyCount; ++index ) { Ecore_Wl_Window_Keygrab_Info *info = (Ecore_Wl_Window_Keygrab_Info*)malloc(sizeof(Ecore_Wl_Window_Keygrab_Info)); - info->key = (char*)Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ); - keyList = eina_list_append(keyList, info); + if( info ) + { + info->key = (char*)Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ); + keyList = eina_list_append(keyList, info); + } } ungrabList = ecore_wl_window_keygrab_list_unset(AnyCast( window.GetNativeHandle() ), keyList); diff --git a/adaptors/tizen/ecore-indicator-impl-tizen.cpp b/adaptors/tizen/ecore-indicator-impl-tizen.cpp index 50e961b..b6cdd6b 100644 --- a/adaptors/tizen/ecore-indicator-impl-tizen.cpp +++ b/adaptors/tizen/ecore-indicator-impl-tizen.cpp @@ -1699,58 +1699,7 @@ void Indicator::OnAnimationFinished(Dali::Animation& animation) void Indicator::OnPan( Dali::Actor actor, const Dali::PanGesture& gesture ) { - return ; - - if( mServerConnection ) - { - switch( gesture.state ) - { - case Gesture::Started: - { - mGestureDetected = false; - - // The gesture position is the current position after it has moved by the displacement. - // We want to reference the original position. - mGestureDeltaY = gesture.position.y - gesture.displacement.y; - } - - // No break, Fall through - case Gesture::Continuing: - { - if( mVisible == Dali::Window::AUTO && !mIsShowing ) - { - // Only take one touch point - if( gesture.numberOfTouches == 1 && mGestureDetected == false ) - { - mGestureDeltaY += gesture.displacement.y; - - if( mGestureDeltaY >= mImageHeight * SHOWING_DISTANCE_HEIGHT_RATE ) - { - ShowIndicator( AUTO_INDICATOR_STAY_DURATION ); - mGestureDetected = true; - } - } - } - - break; - } - - case Gesture::Finished: - case Gesture::Cancelled: - { - // if indicator is showing, hide again when touching is finished (Since touch leave is activated, checking it in gesture::finish instead of touch::up) - if( mVisible == Dali::Window::AUTO && mIsShowing ) - { - ShowIndicator( AUTO_INDICATOR_STAY_DURATION ); - } - break; - } - - - default: - break; - } - } + // Nothing to do, but we still want to consume pan } void Indicator::OnStageTouched(const Dali::TouchData& touchData) -- 2.7.4