[Bluetooth][Non-ACR] Invalid increased count issue (#1614)
authorWootak <wootak.jung@samsung.com>
Thu, 28 May 2020 01:03:34 +0000 (10:03 +0900)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 01:03:34 +0000 (10:03 +0900)
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs

index 8b57289..6d772d9 100644 (file)
@@ -38,7 +38,6 @@ namespace Tizen.Network.Bluetooth
         private Interop.Bluetooth.GattConnectionStateChangedCallBack _gattConnectionStateChangedCallback;
 
         private int _serviceListCount = 0;
-        private IList<BluetoothLeServiceData> _list = new List<BluetoothLeServiceData>();
         private bool _scanStarted;
 
         internal static BluetoothLeImplAdapter Instance
@@ -394,17 +393,18 @@ namespace Tizen.Network.Bluetooth
 
             Log.Info(Globals.LogTag, "Count of ServiceDataList: " + _serviceListCount);
 
+            IList<BluetoothLeServiceData> list = new List<BluetoothLeServiceData>();
             int sizePointerToABC = Marshal.SizeOf(new BluetoothLeServiceDataStruct());
             for (int i = 0; i < _serviceListCount; i++)
             {
                 var svc = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(new IntPtr(serviceListArray.ToInt32() + (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct));
-                _list.Add(BluetoothUtils.ConvertStructToLeServiceData(svc));
+                list.Add(BluetoothUtils.ConvertStructToLeServiceData(svc));
             }
 
             Interop.Bluetooth.FreeServiceDataList(serviceListArray, _serviceListCount);
             Marshal.FreeHGlobal(scanDataStruct.AdvData);
             Marshal.FreeHGlobal(scanDataStruct.ScanData);
-            return _list;
+            return list;
         }
 
         internal int GetScanResultAppearance(BluetoothLeScanData scanData, BluetoothLePacketType packetType)