[Maps] Prevent crashes caused by releasing unmanaged resources 53/161553/2
authorchanywa <cbible.kim@samsung.com>
Fri, 24 Nov 2017 06:02:00 +0000 (15:02 +0900)
committerchanywa <cbible.kim@samsung.com>
Mon, 27 Nov 2017 06:00:22 +0000 (15:00 +0900)
Change-Id: I1c428bcd31217d013f62ac8887fa53da89a8647c

src/Tizen.Maps/Tizen.Maps/MapService.cs
src/Tizen.Maps/Tizen.Maps/MapView.cs
src/Tizen.Maps/Tizen.Maps/SearchPreference.cs

index a4ee487..b0c68e5 100755 (executable)
@@ -235,7 +235,7 @@ namespace Tizen.Maps
         /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
         public bool IsSupported(ServiceRequestType type)
         {
-            bool result;
+            bool result = false;
             var err = handle.IsServiceSupported((Interop.ServiceType)type, out result);
             err.WarnIfFailed($"Failed to get if {type} is supported");
             return (err.IsSuccess()) ? result : false;
@@ -252,7 +252,7 @@ namespace Tizen.Maps
         /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
         public bool IsSupported(ServiceData data)
         {
-            bool result;
+            bool result = false;
             var err = handle.IsDataSupported((Interop.ServiceData)data, out result);
             err.WarnIfFailed($"Failed to get if {data} data is supported");
             return (err.IsSuccess()) ? result : false;
index 54638d4..d25e4b7 100755 (executable)
@@ -60,6 +60,7 @@ namespace Tizen.Maps
         public MapView(EvasObject parent, MapService service) : base(parent)
         {
             handle = new Interop.ViewHandle(service.handle, this);
+            service.handle.HasOwnership = false;
             Log.Info(string.Format("MapView is created"));
 
             _service = service;
@@ -775,6 +776,7 @@ namespace Tizen.Maps
                     _handleToObjectTable?.Clear();
                 }
                 handle?.Dispose();
+                _service.handle.HasOwnership = true;
                 _disposedValue = true;
             }
         }
index 4dd5435..18afd09 100755 (executable)
@@ -248,6 +248,10 @@ namespace Tizen.Maps
         {
             if (!_disposedValue)
             {
+                if (disposing)
+                {
+                    _properties?.Clear();
+                }
                 handle?.Dispose();
                 _disposedValue = true;
             }