[NUI] Call Dispose when WidgetApplication is terminated
authortscholb <scholb.kim@samsung.com>
Wed, 27 Jul 2022 06:09:26 +0000 (15:09 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Tue, 2 Aug 2022 06:47:49 +0000 (15:47 +0900)
WidgetAppcation need to delete it's BaseHandle when it is termianted.

src/Tizen.NUI/src/internal/Application/NUIWidgetCoreBackend.cs
src/Tizen.NUI/src/internal/Widget/WidgetApplication.cs

index 5c79e29..32fb21b 100755 (executable)
@@ -121,6 +121,7 @@ namespace Tizen.NUI
             application.Terminating += OnTerminated;
 
             application.MainLoop();
+            application.Dispose();
         }
 
         /// <summary>
index 28d7225..cd4ed31 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ namespace Tizen.NUI
 
             IntPtr widgetIntPtr = Interop.WidgetApplication.New(argc, argvStr, stylesheet);
 
-            WidgetApplication ret = new WidgetApplication(widgetIntPtr, false);
+            WidgetApplication ret = new WidgetApplication(widgetIntPtr, true);
 
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
@@ -69,6 +69,19 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            base.Dispose(type);
+        }
+
         public void RegisterWidgetCreatingFunction()
         {
             foreach (KeyValuePair<System.Type, string> widgetInfo in widgetInfo)