[Tizen.Network.Bluetooth][Non-ACR] Fix app crash issue during free (#1531)
authorWootak <wootak.jung@samsung.com>
Fri, 10 Apr 2020 04:49:43 +0000 (13:49 +0900)
committerGitHub <noreply@github.com>
Fri, 10 Apr 2020 04:49:43 +0000 (13:49 +0900)
Fix app crash issue during free
Remove unused function

Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapter.cs
src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs

index db0e2ec..c603bf8 100644 (file)
@@ -173,17 +173,6 @@ namespace Tizen.Network.Bluetooth {
         }
 
         /// <summary>
-        /// BluetoothLeDevice destructor.
-        /// </summary>
-        ~BluetoothLeDevice()
-        {
-            if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
-            {
-                BluetoothLeImplAdapter.Instance.FreeServiceDataList();
-            }
-        }
-
-        /// <summary>
         /// The remote address.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
index bfd7c2f..8b57289 100644 (file)
@@ -401,32 +401,12 @@ namespace Tizen.Network.Bluetooth
                 _list.Add(BluetoothUtils.ConvertStructToLeServiceData(svc));
             }
 
-            Interop.Libc.Free(serviceListArray);
+            Interop.Bluetooth.FreeServiceDataList(serviceListArray, _serviceListCount);
             Marshal.FreeHGlobal(scanDataStruct.AdvData);
             Marshal.FreeHGlobal(scanDataStruct.ScanData);
             return _list;
         }
 
-        internal int FreeServiceDataList()
-        {
-            if (_list.Count > 0)
-            {
-                int iServiceDataSize = Marshal.SizeOf(typeof(BluetoothLeServiceData));
-                IntPtr structServiceData = Marshal.AllocHGlobal(iServiceDataSize);
-                Marshal.StructureToPtr(_list, structServiceData, false);
-
-                int ret = Interop.Bluetooth.FreeServiceDataList(structServiceData, _serviceListCount);
-                if (ret != (int)BluetoothError.None)
-                {
-                    Log.Error(Globals.LogTag, "Failed to free Service Data List, Error - " + (BluetoothError)ret);
-                    BluetoothErrorFactory.ThrowBluetoothException(ret);
-                }
-
-                Marshal.FreeHGlobal(structServiceData);
-            }
-            return 0;
-        }
-
         internal int GetScanResultAppearance(BluetoothLeScanData scanData, BluetoothLePacketType packetType)
         {
             if (!BluetoothAdapter.IsBluetoothEnabled || !Globals.IsInitialize)