[3.0] Fix SVACE issues 46/141646/1 accepted/tizen/3.0/common/20170808.135316 accepted/tizen/3.0/ivi/20170808.070701 accepted/tizen/3.0/mobile/20170808.070632 accepted/tizen/3.0/tv/20170808.070619 accepted/tizen/3.0/wearable/20170808.070644 submit/tizen_3.0/20170807.060155
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 1 Aug 2017 08:00:36 +0000 (17:00 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 1 Aug 2017 08:04:16 +0000 (17:04 +0900)
- 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 <seoyeon2.kim@samsung.com>
adaptors/ecore/common/ecore-indicator-impl.cpp
adaptors/ecore/wayland/key-grab-ecore-wl.cpp
adaptors/tizen/ecore-indicator-impl-tizen.cpp

index 6eaefb9..43363fb 100644 (file)
@@ -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)
index 85f92c3..5d46e7b 100755 (executable)
@@ -99,28 +99,31 @@ Dali::Vector<bool> GrabKeyList( Window window, const Dali::Vector<Dali::KEY>& da
   for( Dali::Vector<float>::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<Ecore_Wl_Window*>( window.GetNativeHandle() ), keyList);
@@ -168,8 +171,11 @@ Dali::Vector<bool> UngrabKeyList( Window window, const Dali::Vector<Dali::KEY>&
   for( Dali::Vector<float>::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<Ecore_Wl_Window*>( window.GetNativeHandle() ), keyList);
index 50e961b..b6cdd6b 100644 (file)
@@ -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)