[NUI] Fix some API to use GetManagedBaseHandleFromNativePtr (#1592)
authortscholb <scholb.kim@samsung.com>
Fri, 8 May 2020 08:24:31 +0000 (17:24 +0900)
committerGitHub <noreply@github.com>
Fri, 8 May 2020 08:24:31 +0000 (17:24 +0900)
- Fix GetWindow() using GetManagedBaseHandleFromNativePtr

src/Tizen.NUI/src/internal/Application.cs [changed mode: 0755->0644]
src/Tizen.NUI/src/internal/WidgetImpl.cs

old mode 100755 (executable)
new mode 100644 (file)
index 204692c..f8cae49
@@ -1351,7 +1351,12 @@ namespace Tizen.NUI
 
         public Window GetWindow()
         {
-            Window ret = new Window(Interop.Application.Application_GetWindow(swigCPtr), true);
+            Window ret = Registry.GetManagedBaseHandleFromNativePtr(Interop.Application.Application_GetWindow(swigCPtr)) as Window;
+            if(ret == null)
+            {
+                ret = new Window(Interop.Application.Application_GetWindow(swigCPtr), true);
+            }
+
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
@@ -1383,7 +1388,8 @@ namespace Tizen.NUI
             return ret;
         }
 
-        internal static List<Window> GetWindowList()
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static List<Window> GetWindowList()
         {
             uint ListSize = Interop.Application.Application_GetWindowsListSize();
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
index b54177bd9679ad857ec25aaa898ab738eea434b3..d548d6de5c214af40937a10c8ea9679809355803 100755 (executable)
@@ -310,7 +310,12 @@ namespace Tizen.NUI
 
         private void SwigDirectorOnCreate(string contentInfo, global::System.IntPtr window)
         {
-            OnCreate(contentInfo, new Window(window, true));
+            Window ret = Registry.GetManagedBaseHandleFromNativePtr(window) as Window;
+            if (ret == null)
+            {
+                ret = new Window(window, true);
+            }
+            OnCreate(contentInfo, ret);
         }
 
         private void SwigDirectorOnTerminate(string contentInfo, int type)
@@ -330,7 +335,12 @@ namespace Tizen.NUI
 
         private void SwigDirectorOnResize(global::System.IntPtr window)
         {
-            OnResize(new Window(window, true));
+            Window ret = Registry.GetManagedBaseHandleFromNativePtr(window) as Window;
+            if (ret == null)
+            {
+                ret = new Window(window, true);
+            }
+            OnResize(ret);
         }
 
         private void SwigDirectorOnUpdate(string contentInfo, int force)