From ce3bd1c7409f1eda6b811d77e828d935e92cde27 Mon Sep 17 00:00:00 2001 From: Umar Date: Thu, 15 Jun 2017 19:04:44 +0100 Subject: [PATCH] Split ViewRegistry into CustomViewRegistry and Registry CustomViewRegistry - For custom views to register themselves as a type Registry - For all base-handle objects including renderers and custom views. This is used to store a mapping between C++ base handle objects and it's C# instances. Change-Id: I2b2e93c653542ebdcd810c8f5977d435fcf5cec2 --- .../NUISamples.TizenTV/examples/custom-control.cs | 2 +- .../visuals-using-custom-view/ContactView.cs | 2 +- .../visuals-using-custom-view.cs | 2 +- Tizen.NUI/src/internal/Alignment.cs | 4 +- Tizen.NUI/src/internal/GaussianBlurView.cs | 4 +- Tizen.NUI/src/internal/ItemView.cs | 2 +- Tizen.NUI/src/internal/Model3dView.cs | 4 +- Tizen.NUI/src/internal/PageTurnLandscapeView.cs | 4 +- Tizen.NUI/src/internal/PageTurnPortraitView.cs | 4 +- Tizen.NUI/src/internal/PageTurnView.cs | 4 +- Tizen.NUI/src/internal/Registry.cs | 122 +++++++++++++++++++++ Tizen.NUI/src/internal/Slider.cs | 2 +- Tizen.NUI/src/public/BaseComponents/View.cs | 10 +- Tizen.NUI/src/public/BaseComponents/VisualView.cs | 6 +- Tizen.NUI/src/public/CustomView/Spin.cs | 2 +- .../CustomViewRegistry.cs} | 113 +++---------------- Tizen.NUI/src/public/Layer.cs | 2 +- Tizen.NUI/src/public/ProgressBar.cs | 2 +- Tizen.NUI/src/public/Scrollable.cs | 2 +- Tizen.NUI/src/public/UIComponents/Button.cs | 4 +- Tizen.NUI/src/public/UIComponents/Popup.cs | 2 +- Tizen.NUI/src/public/UIComponents/RadioButton.cs | 2 +- Tizen.NUI/src/public/UIComponents/ScrollView.cs | 2 +- Tizen.NUI/src/public/UIComponents/ToggleButton.cs | 2 +- Tizen.NUI/src/public/ViewWrapper.cs | 2 +- 25 files changed, 176 insertions(+), 131 deletions(-) create mode 100755 Tizen.NUI/src/internal/Registry.cs rename Tizen.NUI/src/{internal/ViewRegistry.cs => public/CustomViewRegistry.cs} (82%) mode change 100755 => 100644 diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/custom-control.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/custom-control.cs index 57afb4f..0a37c07 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/custom-control.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/custom-control.cs @@ -46,7 +46,7 @@ namespace CustomControlTest { // ViewRegistry registers control type with DALi type registery // also uses introspection to find any properties that need to be registered with type registry - ViewRegistry.Instance.Register(CreateInstance, typeof(StarRating) ); + CustomViewRegistry.Instance.Register(CreateInstance, typeof(StarRating) ); } public StarRating() : base(typeof(StarRating).Name, CustomViewBehaviour.ViewBehaviourDefault) diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs index d33faae..1e25c73 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/ContactView.cs @@ -50,7 +50,7 @@ namespace VisualsUsingCustomView static ContactView() { - ViewRegistry.Instance.Register( CreateInstance, typeof(ContactView)); + CustomViewRegistry.Instance.Register( CreateInstance, typeof(ContactView)); } public ContactView() : base(typeof(ContactView).Name, CustomViewBehaviour.RequiresKeyboardNavigationSupport) diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs index 2143e5c..91f28fb 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs @@ -91,7 +91,7 @@ namespace VisualsUsingCustomView /// The main entry point for the application. /// [STAThread] - static void Main(string[] args) + static void _Main(string[] args) { VisualsExample visualsExample = new VisualsExample(); visualsExample.Run(args); diff --git a/Tizen.NUI/src/internal/Alignment.cs b/Tizen.NUI/src/internal/Alignment.cs index 60bd41e..d1e588b 100755 --- a/Tizen.NUI/src/internal/Alignment.cs +++ b/Tizen.NUI/src/internal/Alignment.cs @@ -64,8 +64,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/GaussianBlurView.cs b/Tizen.NUI/src/internal/GaussianBlurView.cs index 3eb587a..180eb91 100755 --- a/Tizen.NUI/src/internal/GaussianBlurView.cs +++ b/Tizen.NUI/src/internal/GaussianBlurView.cs @@ -68,8 +68,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/ItemView.cs b/Tizen.NUI/src/internal/ItemView.cs index b89d326..15d9bc6 100755 --- a/Tizen.NUI/src/internal/ItemView.cs +++ b/Tizen.NUI/src/internal/ItemView.cs @@ -67,7 +67,7 @@ namespace Tizen.NUI //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/Model3dView.cs b/Tizen.NUI/src/internal/Model3dView.cs index f43f6df..7f1b0fb 100755 --- a/Tizen.NUI/src/internal/Model3dView.cs +++ b/Tizen.NUI/src/internal/Model3dView.cs @@ -64,8 +64,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/PageTurnLandscapeView.cs b/Tizen.NUI/src/internal/PageTurnLandscapeView.cs index f72cb36..5ca22ec 100755 --- a/Tizen.NUI/src/internal/PageTurnLandscapeView.cs +++ b/Tizen.NUI/src/internal/PageTurnLandscapeView.cs @@ -60,8 +60,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/PageTurnPortraitView.cs b/Tizen.NUI/src/internal/PageTurnPortraitView.cs index c839ad1..11b6d07 100755 --- a/Tizen.NUI/src/internal/PageTurnPortraitView.cs +++ b/Tizen.NUI/src/internal/PageTurnPortraitView.cs @@ -60,8 +60,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/PageTurnView.cs b/Tizen.NUI/src/internal/PageTurnView.cs index a7867e0..6f2b240 100755 --- a/Tizen.NUI/src/internal/PageTurnView.cs +++ b/Tizen.NUI/src/internal/PageTurnView.cs @@ -50,8 +50,8 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/internal/Registry.cs b/Tizen.NUI/src/internal/Registry.cs new file mode 100755 index 0000000..ffb9c78 --- /dev/null +++ b/Tizen.NUI/src/internal/Registry.cs @@ -0,0 +1,122 @@ + +//#define DOT_NET_CORE +#if (DOT_NET_CORE) +using System.Reflection; +#endif +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// This is used to store a mapping between C++ base handle objects and it's C# instances. + /// + /// + internal sealed class Registry + { + /// + /// Registry is a singleton + /// + private static Registry instance = null; + + /// + /// Given a C++ object the dictionary allows us to find which C# object it belongs to. + /// By keeping the weak reference only, it will allow the object to be garbage collected. + /// + private Dictionary _controlMap; + + private Registry() + { + _controlMap = new Dictionary(); + } + + + /// + /// Store the mapping between this instance of BaseHandle (C# base class) and native part. + /// + /// The instance of BaseHandle (C# base class) + internal static void Register(BaseHandle baseHandle) + { + // We store a pointer to the RefObject for the control + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); + +#if DEBUG_ON + Tizen.Log.Debug("NUI", "________Storing ref object cptr in control map Hex: {0:X}" + refCptr); +#endif + if (!Instance._controlMap.ContainsKey(refCptr)) + { + Instance._controlMap.Add(refCptr, new WeakReference(baseHandle, false)); + } + + return; + } + + /// + /// Remove the this instance of BaseHandle (C# base class) and native part from the mapping table. + /// + /// The instance of BaseHandle (C# base class) + internal static void Unregister(BaseHandle baseHandle) + { + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); + + if (Instance._controlMap.ContainsKey(refCptr)) + { + Instance._controlMap.Remove(refCptr); + } + + return; + } + + private static Registry Instance + { + get + { + if (instance == null) + { + instance = new Registry(); + } + return instance; + } + } + + internal static BaseHandle GetManagedBaseHandleFromNativePtr(BaseHandle baseHandle) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); + + WeakReference viewReference; + if (Instance._controlMap.TryGetValue(refObjectPtr, out viewReference)) + { + BaseHandle ret = viewReference.Target as BaseHandle; + return ret; + } + else + { + return null; + } + } + + internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + + WeakReference weakReference; + if (Instance._controlMap.TryGetValue(refObjectPtr, out weakReference)) + { + BaseHandle ret = weakReference.Target as BaseHandle; + return ret; + } + else + { + return null; + } + } + + } +} diff --git a/Tizen.NUI/src/internal/Slider.cs b/Tizen.NUI/src/internal/Slider.cs index a6abd07..e7fcdd1 100755 --- a/Tizen.NUI/src/internal/Slider.cs +++ b/Tizen.NUI/src/internal/Slider.cs @@ -73,7 +73,7 @@ namespace Tizen.NUI.UIComponents //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/BaseComponents/View.cs b/Tizen.NUI/src/public/BaseComponents/View.cs index 6de4705..80b3a38 100755 --- a/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/Tizen.NUI/src/public/BaseComponents/View.cs @@ -31,8 +31,8 @@ namespace Tizen.NUI.BaseComponents { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - // Register this instance of view in the view registry. - ViewRegistry.RegisterView(this); + // Register this instance of view in the registry. + Registry.Register(this); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) @@ -60,7 +60,7 @@ namespace Tizen.NUI.BaseComponents //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { @@ -846,7 +846,7 @@ namespace Tizen.NUI.BaseComponents /// A object which inherit View public static T DownCast(View view) where T : View { - View ret = ViewRegistry.GetViewFromBaseHandle(view); + View ret = Registry.GetManagedBaseHandleFromNativePtr(view) as View; if (ret != null) { return (T)ret; @@ -2093,7 +2093,7 @@ namespace Tizen.NUI.BaseComponents BaseHandle ret = new BaseHandle(cPtr, false); - View temp = ViewRegistry.GetViewFromBaseHandle(ret); + View temp = Registry.GetManagedBaseHandleFromNativePtr(ret) as View; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/Tizen.NUI/src/public/BaseComponents/VisualView.cs index 260fcd8..9b6a90f 100755 --- a/Tizen.NUI/src/public/BaseComponents/VisualView.cs +++ b/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -54,7 +54,7 @@ namespace Tizen.NUI.BaseComponents { // ViewRegistry registers control type with DALi type registery // also uses introspection to find any properties that need to be registered with type registry - ViewRegistry.Instance.Register(CreateInstance, typeof(VisualView)); + CustomViewRegistry.Instance.Register(CreateInstance, typeof(VisualView)); } public VisualView() : base(typeof(VisualView).Name, CustomViewBehaviour.ViewBehaviourDefault) @@ -475,7 +475,7 @@ namespace Tizen.NUI.BaseComponents } - //temporary fix to pass TCT + //temporary fix to pass TCT public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap) { foreach (var item in _visualDictionary.ToList()) @@ -488,7 +488,7 @@ namespace Tizen.NUI.BaseComponents } return null; } - //temporary fix to pass TCT + //temporary fix to pass TCT } } diff --git a/Tizen.NUI/src/public/CustomView/Spin.cs b/Tizen.NUI/src/public/CustomView/Spin.cs index f5f71a4..2f0664d 100755 --- a/Tizen.NUI/src/public/CustomView/Spin.cs +++ b/Tizen.NUI/src/public/CustomView/Spin.cs @@ -58,7 +58,7 @@ namespace Tizen.NUI { // ViewRegistry registers control type with DALi type registery // also uses introspection to find any properties that need to be registered with type registry - ViewRegistry.Instance.Register(CreateInstance, typeof(Spin)); + CustomViewRegistry.Instance.Register(CreateInstance, typeof(Spin)); } /// diff --git a/Tizen.NUI/src/internal/ViewRegistry.cs b/Tizen.NUI/src/public/CustomViewRegistry.cs old mode 100755 new mode 100644 similarity index 82% rename from Tizen.NUI/src/internal/ViewRegistry.cs rename to Tizen.NUI/src/public/CustomViewRegistry.cs index 67abc4b..2a5763a --- a/Tizen.NUI/src/internal/ViewRegistry.cs +++ b/Tizen.NUI/src/public/CustomViewRegistry.cs @@ -74,7 +74,7 @@ namespace Tizen.NUI /// /// /// - internal class ScriptableProperty : System.Attribute + public class ScriptableProperty : System.Attribute { public enum ScriptableType { @@ -123,33 +123,27 @@ namespace Tizen.NUI /// /// /// - public sealed class ViewRegistry + public sealed class CustomViewRegistry { /// /// ViewRegistry is a singleton /// - private static ViewRegistry instance = null; + private static CustomViewRegistry instance = null; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate IntPtr CreateControlDelegate(IntPtr cPtrControlName); + private delegate IntPtr CreateControlDelegate(IntPtr cPtrControlName); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate IntPtr GetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName); + private delegate IntPtr GetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName); [UnmanagedFunctionPointer(CallingConvention.StdCall)] - delegate void SetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName, IntPtr propertyValue); + private delegate void SetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName, IntPtr propertyValue); private CreateControlDelegate _createCallback; private SetPropertyDelegate _setPropertyCallback; private GetPropertyDelegate _getPropertyCallback; private PropertyRangeManager _propertyRangeManager; - /// - /// Given a C++ control the dictionary allows us to find which C# control (View) it belongs to. - /// By keeping the weak reference only, it will allow the object to be garbage collected. - /// - private Dictionary _controlMap; - /// // Maps the name of a custom view to a create instance function /// E.g. given a string "Spin", we can get a function used to create the Spin View. @@ -178,16 +172,14 @@ namespace Tizen.NUI }; - private ViewRegistry() + private CustomViewRegistry() { _createCallback = new CreateControlDelegate(CreateControl); _getPropertyCallback = new GetPropertyDelegate(GetProperty); _setPropertyCallback = new SetPropertyDelegate(SetProperty); - _controlMap = new Dictionary(); _constructorMap = new Dictionary>(); _propertyRangeManager = new PropertyRangeManager(); - } private Tizen.NUI.PropertyType GetDaliPropertyType(string cSharpTypeName) @@ -236,44 +228,6 @@ namespace Tizen.NUI } } - /// - /// Store the mapping between this instance of control (View) and native part. - /// - /// The instance of control (View) - internal static void RegisterView(View view) - { - // We store a pointer to the RefObject for the control - RefObject refObj = view.GetObjectPtr(); - IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); - -#if DEBUG_ON - Tizen.Log.Debug("NUI", "________Storing ref object cptr in control map Hex: {0:X}" + refCptr); -#endif - if (!Instance._controlMap.ContainsKey(refCptr)) - { - Instance._controlMap.Add(refCptr, new WeakReference(view, false)); - } - - return; - } - - /// - /// Remove the this instance of control (View) and native part from the mapping table. - /// - /// The instance of control (View) - internal static void UnregisterView(View view) - { - RefObject refObj = view.GetObjectPtr(); - IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); - - if (Instance._controlMap.ContainsKey(refCptr)) - { - Instance._controlMap.Remove(refCptr); - } - - return; - } - private static IntPtr GetProperty(IntPtr controlPtr, IntPtr propertyName) { string name = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(propertyName); @@ -290,39 +244,18 @@ namespace Tizen.NUI } - public static ViewRegistry Instance + public static CustomViewRegistry Instance { get { if (instance == null) { - instance = new ViewRegistry(); + instance = new CustomViewRegistry(); } return instance; } } - - internal static View GetViewFromBaseHandle(BaseHandle baseHandle) - { - // we store a dictionary of ref-obects (C++ land) to custom views (C# land) - - RefObject refObj = baseHandle.GetObjectPtr(); - IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); - - WeakReference viewReference; - if (Instance._controlMap.TryGetValue(refObjectPtr, out viewReference)) - { - View retview = viewReference.Target as View; - return retview; - } - else - { - return null; - } - } - - /// /// Function which registers a view and all it's scriptable properties with DALi's type registry. /// Means the View can be created / configured from a JSON script. @@ -394,20 +327,12 @@ namespace Tizen.NUI /// Get a property value from a View /// /// - private IntPtr GetPropertyValue(IntPtr controlPtr, string propertyName) + private IntPtr GetPropertyValue(IntPtr refObjectPtr, string propertyName) { // Get the C# control that maps to the C++ control - BaseHandle baseHandle = new BaseHandle(controlPtr, false); - - RefObject refObj = baseHandle.GetObjectPtr(); - - IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); - - WeakReference viewReference; - if (_controlMap.TryGetValue(refObjectPtr, out viewReference)) + View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View; + if (view != null) { - View view = viewReference.Target as View; - // call the get property function System.Object val = view.GetType().GetProperty(propertyName).GetAccessors()[0].Invoke(view, null); @@ -425,18 +350,18 @@ namespace Tizen.NUI /// Set a property value on a View /// /// - private void SetPropertyValue(IntPtr controlPtr, string propertyName, IntPtr propertyValuePtr) + private void SetPropertyValue(IntPtr refObjectPtr, string propertyName, IntPtr propertyValuePtr) { // Get the C# control that maps to the C++ control #if DEBUG_ON - Tizen.Log.Debug("NUI", "SetPropertyValue refObjectPtr = {0:X}" + controlPtr); + Tizen.Log.Debug("NUI", "SetPropertyValue refObjectPtr = {0:X}" + refObjectPtr); #endif PropertyValue propValue = new PropertyValue(propertyValuePtr, false); - WeakReference viewReference; - if (_controlMap.TryGetValue(controlPtr, out viewReference)) + // Get the C# control that maps to the C++ control + View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View; + if (view != null) { - View view = viewReference.Target as View; System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName); // We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type @@ -546,12 +471,10 @@ namespace Tizen.NUI } else { - throw new global::System.InvalidOperationException("failed to find the control to write a property to: cptr = " + controlPtr); + throw new global::System.InvalidOperationException("failed to find the control to write a property to: cptr = " + refObjectPtr); } } } - - } diff --git a/Tizen.NUI/src/public/Layer.cs b/Tizen.NUI/src/public/Layer.cs index 4c48ab6..d7ffb21 100755 --- a/Tizen.NUI/src/public/Layer.cs +++ b/Tizen.NUI/src/public/Layer.cs @@ -283,7 +283,7 @@ namespace Tizen.NUI BaseHandle ret = new BaseHandle(cPtr, false); - View temp = ViewRegistry.GetViewFromBaseHandle(ret); + View temp = Registry.GetManagedBaseHandleFromNativePtr(ret) as View; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/Tizen.NUI/src/public/ProgressBar.cs b/Tizen.NUI/src/public/ProgressBar.cs index 6085d40..e2dfec4 100755 --- a/Tizen.NUI/src/public/ProgressBar.cs +++ b/Tizen.NUI/src/public/ProgressBar.cs @@ -73,7 +73,7 @@ namespace Tizen.NUI.UIComponents //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/Scrollable.cs b/Tizen.NUI/src/public/Scrollable.cs index f6edecc..9602bef 100755 --- a/Tizen.NUI/src/public/Scrollable.cs +++ b/Tizen.NUI/src/public/Scrollable.cs @@ -51,7 +51,7 @@ namespace Tizen.NUI //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/UIComponents/Button.cs b/Tizen.NUI/src/public/UIComponents/Button.cs index 2f6422f..7df120d 100755 --- a/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/Tizen.NUI/src/public/UIComponents/Button.cs @@ -74,8 +74,8 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + //Unreference this from if a static instance refer to this. + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/UIComponents/Popup.cs b/Tizen.NUI/src/public/UIComponents/Popup.cs index e3c8072..567eb80 100755 --- a/Tizen.NUI/src/public/UIComponents/Popup.cs +++ b/Tizen.NUI/src/public/UIComponents/Popup.cs @@ -71,7 +71,7 @@ namespace Tizen.NUI.UIComponents //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/UIComponents/RadioButton.cs b/Tizen.NUI/src/public/UIComponents/RadioButton.cs index 709dc38..f8816a9 100755 --- a/Tizen.NUI/src/public/UIComponents/RadioButton.cs +++ b/Tizen.NUI/src/public/UIComponents/RadioButton.cs @@ -77,7 +77,7 @@ namespace Tizen.NUI.UIComponents //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/UIComponents/ScrollView.cs b/Tizen.NUI/src/public/UIComponents/ScrollView.cs index b521e63..0846305 100755 --- a/Tizen.NUI/src/public/UIComponents/ScrollView.cs +++ b/Tizen.NUI/src/public/UIComponents/ScrollView.cs @@ -65,7 +65,7 @@ namespace Tizen.NUI //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/UIComponents/ToggleButton.cs b/Tizen.NUI/src/public/UIComponents/ToggleButton.cs index 0f430ba..2ed083f 100755 --- a/Tizen.NUI/src/public/UIComponents/ToggleButton.cs +++ b/Tizen.NUI/src/public/UIComponents/ToggleButton.cs @@ -63,7 +63,7 @@ namespace Tizen.NUI //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { diff --git a/Tizen.NUI/src/public/ViewWrapper.cs b/Tizen.NUI/src/public/ViewWrapper.cs index 978da1a..087d503 100755 --- a/Tizen.NUI/src/public/ViewWrapper.cs +++ b/Tizen.NUI/src/public/ViewWrapper.cs @@ -56,7 +56,7 @@ namespace Tizen.NUI //because the execution order of Finalizes is non-deterministic. //Unreference this from if a static instance refer to this. - ViewRegistry.UnregisterView(this); + Registry.Unregister(this); if (swigCPtr.Handle != global::System.IntPtr.Zero) { -- 2.7.4