[NUI] Fix recursion when the view sets KeyboardNavigationSupport to true (#2100)
authorJiyun Yang <ji.yang@samsung.com>
Fri, 6 Nov 2020 07:09:35 +0000 (16:09 +0900)
committerGitHub <noreply@github.com>
Fri, 6 Nov 2020 07:09:35 +0000 (16:09 +0900)
In Dali code, the method GetNextKeyboardFocuableActor should return
an empty actor (= the base handle without a referenced object)
if there is no actor can be focused.

The corresponding method in NUI is GetNextFocusableView.
It returned new View() (that is not an empty actor) which leads to the wrong result.
So instead returning new View, this patch returns a null IntPtr.

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
src/Tizen.NUI/src/internal/ViewWrapperImpl.cs
src/Tizen.NUI/src/public/BaseComponents/CustomView.cs

index 0ba7cb9..b386bea 100755 (executable)
@@ -475,14 +475,10 @@ namespace Tizen.NUI
         private global::System.IntPtr DirectorGetNextFocusableActor(global::System.IntPtr currentFocusedActor, int direction, bool loopEnabled)
         {
             View view = GetNextFocusableView(Registry.GetManagedBaseHandleFromNativePtr(currentFocusedActor) as View, (View.FocusDirection)direction, loopEnabled);
-            if (view)
-            {
-                return View.getCPtr(view).Handle;
-            }
-            else
-            {
-                return currentFocusedActor;
-            }
+
+            if (view != null) return View.getCPtr(view).Handle;
+
+            return global::System.IntPtr.Zero;
         }
 
         private void DirectorOnFocusChangeCommitted(global::System.IntPtr commitedFocusableView)
index 994a668..4ed82c4 100755 (executable)
@@ -429,11 +429,11 @@ namespace Tizen.NUI.BaseComponents
         /// <param name="currentFocusedView">The current focused view.</param>
         /// <param name="direction">The direction to move the focus towards.</param>
         /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
-        /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
+        /// <returns>The next keyboard focusable view in this control or null if no view can be focused.</returns>
         /// <since_tizen> 3 </since_tizen>
         public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)
         {
-            return new View();
+            return null;
         }
 
         /// <summary>