Fix ApplicationManagerImpl/MessagePort finalizer
authorSeungkeun Lee <sngn.lee@samsung.com>
Thu, 7 Apr 2016 04:59:54 +0000 (13:59 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Mon, 11 Apr 2016 00:44:07 +0000 (09:44 +0900)
 - If implemented IDisposable interface, finalizer only call Dispose(false)

Change-Id: I849eaafa65c519834994f9418d1b31c71e46f77a

Tizen.Applications/Tizen.Applications.Managers/ApplicationManagerImpl.cs
Tizen.Applications/Tizen.Applications.Messages/MessagePort.cs

index 3fb98cb..482565a 100755 (executable)
@@ -32,8 +32,6 @@ namespace Tizen.Applications.Managers
 
         ~ApplicationManagerImpl()
         {
-            Log.Debug(LogTag, "~ApplicationManagerImpl()");
-            UnRegisterApplicationChangedEvent();
             Dispose(false);
         }
 
@@ -64,6 +62,7 @@ namespace Tizen.Applications.Managers
                 // Free managed objects.
             }
             //Free unmanaged objects
+            UnRegisterApplicationChangedEvent();
             _disposed = true;
         }
 
index 3d9563b..97c61e3 100755 (executable)
@@ -39,10 +39,6 @@ namespace Tizen.Applications.Messages
 
         ~MessagePort()
         {
-            if (_listening)
-            {
-                StopListening();
-            }
             Dispose(false);
         }
 
@@ -212,7 +208,13 @@ namespace Tizen.Applications.Messages
         {
             if (_listening)
             {
-                StopListening();
+                try
+                {
+                    StopListening();
+                } catch (Exception e)
+                {
+                    Tizen.Log.Warn(GetType().Namespace, "Exception in Dispose :" + e.Message);
+                }
             }
         }