From 60b651403badab9e4213eb5af3cea99cb80ef492 Mon Sep 17 00:00:00 2001 From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Fri, 10 May 2019 15:39:15 +0900 Subject: [PATCH] [NUI] Remove throw exception for WidgetView, Enable NameScopeExtensions.FindByName() (#828) Signed-off-by: dongsug.song --- src/Tizen.NUI/src/internal/Registry.cs | 3 ++- src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs | 5 +++++ src/Tizen.NUI/src/public/Layer.cs | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/internal/Registry.cs b/src/Tizen.NUI/src/internal/Registry.cs index 7e33d03..c4e743a 100755 --- a/src/Tizen.NUI/src/internal/Registry.cs +++ b/src/Tizen.NUI/src/internal/Registry.cs @@ -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; diff --git a/src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs b/src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs index 912886e..e486e97 100755 --- a/src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs +++ b/src/Tizen.NUI/src/internal/Xaml/XamlLoader.cs @@ -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 { diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 63345a0..3a21ad4 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -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; + } + /// /// Increments the depth of the layer. /// -- 2.7.4