Fix that points of the polygon are not delivered to C API when created
authorchanywa <cbible.kim@samsung.com>
Thu, 2 Feb 2017 09:30:59 +0000 (18:30 +0900)
committerchanywa <cbible.kim@samsung.com>
Thu, 2 Feb 2017 09:41:14 +0000 (18:41 +0900)
Change-Id: I7e6a5b6e95131a446d4b867dc02a6f8b8b4786c4

src/Tizen.Location/Tizen.Location/LocationBoundary.cs

index 32f89fd..e503e19 100755 (executable)
@@ -265,14 +265,11 @@ namespace Tizen.Location
         {
             Log.Info(Globals.LogTag, "Calling PolygonBoundary Constructor");
             BoundaryType = BoundaryType.Polygon;
-            IntPtr[] pointers = new IntPtr[coordinates.Count];
             IntPtr listPointer = Marshal.AllocHGlobal(Marshal.SizeOf(coordinates[0]) * coordinates.Count);
             IntPtr boundsHandle;
             for (int i = 0; i < coordinates.Count; i++)
             {
-                pointers[i] = Marshal.AllocHGlobal(Marshal.SizeOf(coordinates[0]));
-                Marshal.StructureToPtr(coordinates[i], pointers[i], true);
-                Marshal.WriteIntPtr(listPointer, i * Marshal.SizeOf(coordinates[0]), pointers[i]);
+                Marshal.StructureToPtr(coordinates[i], listPointer + i * Marshal.SizeOf(coordinates[0]), false);
             }
             int ret = Interop.LocationBoundary.CreatePolygonBoundary(listPointer, coordinates.Count, out boundsHandle);
             if ((LocationBoundError)ret != LocationBoundError.None)