[NUI] Remove throw exception for WidgetView, Enable NameScopeExtensions.FindByName...
authordongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 10 May 2019 06:39:15 +0000 (15:39 +0900)
committerGitHub <noreply@github.com>
Fri, 10 May 2019 06:39:15 +0000 (15:39 +0900)
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
src/Tizen.NUI/src/internal/Registry.cs
src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs
src/Tizen.NUI/src/public/Layer.cs

index 7e33d03..c4e743a 100755 (executable)
@@ -159,7 +159,8 @@ namespace Tizen.NUI
             if (savedApplicationThread == null)
             {
                 Tizen.Log.Fatal("NUI", $"Error! maybe main thread is created by other process\n");
-                throw new global::System.ApplicationException("Error! maybe main thread is created by other process");
+                return;
+                //throw new global::System.ApplicationException("Error! maybe main thread is created by other process");
             }
             int currentId = Thread.CurrentThread.ManagedThreadId;
             int mainThreadId = savedApplicationThread.ManagedThreadId;
index 912886e..e486e97 100755 (executable)
@@ -138,6 +138,11 @@ namespace Tizen.NUI.Xaml
                         continue;
                     }
 
+                    if (view is Element)
+                    {
+                        (view as Element).IsCreateByXaml = true;
+                    }
+
                     var rootnode = new RuntimeRootNode (new XmlType (reader.NamespaceURI, reader.Name, null), view, (IXmlNamespaceResolver)reader);
                     XamlParser.ParseXaml (rootnode, reader);
                     Visit (rootnode, new HydrationContext {
index 63345a0..3a21ad4 100755 (executable)
@@ -381,6 +381,22 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public View FindChildByName(string viewName)
+        {
+            //to fix memory leak issue, match the handle count with native side.
+            IntPtr cPtr = Interop.Actor.Actor_FindChildByName(swigCPtr, viewName);
+            HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+            View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View;
+            Interop.BaseHandle.delete_BaseHandle(CPtr);
+            CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         /// <summary>
         /// Increments the depth of the layer.
         /// </summary>