From 1bcdcc2419b9b4f9c64db740f71bacfb8cd02127 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 3 Oct 2018 21:17:23 +0100 Subject: [PATCH] mantis 8384: try to fix bullet heimap managed memory sharing with unmanaged lib --- .../BulletS/BSTerrainHeightmap.cs | 1 + .../PhysicsModules/BulletS/BulletSimData.cs | 10 +++++++++- bin/OpenSim32.pdb | Bin 11776 -> 0 bytes 3 files changed, 10 insertions(+), 1 deletion(-) delete mode 100644 bin/OpenSim32.pdb diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs index f72ad28600..1cb948e802 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs @@ -136,6 +136,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys // Frees both the body and the shape. m_physicsScene.PE.DestroyObject(m_physicsScene.World, m_mapInfo.terrainBody); } + m_mapInfo.Release(); } m_mapInfo = null; } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs index 308769b3d0..9f4f4a6130 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Runtime.InteropServices; using OMV = OpenMetaverse; namespace OpenSim.Region.PhysicsModule.BulletS @@ -169,7 +170,7 @@ public class BulletHMapInfo public BulletHMapInfo(uint id, float[] hm, float pSizeX, float pSizeY) { ID = id; heightMap = hm; - terrainRegionBase = OMV.Vector3.Zero; + heightMapHandle = GCHandle.Alloc(heightMap, GCHandleType.Pinned); minCoords = new OMV.Vector3(100f, 100f, 25f); maxCoords = new OMV.Vector3(101f, 101f, 26f); minZ = maxZ = 0f; @@ -185,6 +186,13 @@ public class BulletHMapInfo public float minZ, maxZ; public BulletShape terrainShape; public BulletBody terrainBody; + private GCHandle heightMapHandle; + + public void Release() + { + if(heightMapHandle.IsAllocated) + heightMapHandle.Free(); + } } // The general class of collsion object. diff --git a/bin/OpenSim32.pdb b/bin/OpenSim32.pdb deleted file mode 100644 index 86d30585312f8965c7db582a8c58516fa7ad72df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11776 zcmeHNTWl0n82)D|(CrNtv0O^XqBKE@yR&Vn1Oi1$NvqwIW@92|LfNiUI%#(XcSaOK zLK6~vkU(Sl0s#`@n>?Z~D%uc*;3GtzG*KQ57(#=Z$P?@LpP2(|Q#a9KTz1dD{pLUS z%lDtloHI>YnVjP~!(Oy2-qq3)O{R85UyA8^ea*_9DT0K=A1#CPUG_ts^_6;-0RvNc zC6&y;CQ>7ylI>snO+wqm>)7G|Pz{vNS3&3V^YBzs&J4_E|3%9FD&lYxUjG`(-UGV$$|(|XU3XJtZ;V-(8w18p;d3Zs?#DPdr?`Oo`d;rh>h?#@j8 zlyp%wvj_vq{zb^CfT#yU1D#hF-i%D7XsZ9i(1owMUp;;2=NplUPTya9?)V##;hT}m z>xmvz_g=o+xIDl2qs7Vh{&0FT$J+NT4LCZwYX6xNeap8zzb(}9#r2=A9Qp0qwF;oG zY`VBG=!w*2(=pYNq6|EoemKo9a)&up*Jk78gO;84EXOuH)Ad{{Yq%rnoN2VR?y$VR z^xJl3#OOa@+9@mB)@tm|Is0?zY%JpvWi}h>zs)>kd1HQN2bobUG9P%Hncp_H0^E{q z0E;?%`aJx%&!$_tHjXOZn*N~r!mS(HKYgj^^td7xmXmqeg6jY-`^34?Nh6473v-+a zC@BpFc;>}ueS}*x5j3fA4}eVOk-sXy$KYprPh0(IO>C zTNO#7qDp{)x)NxEYQmFeU^O*}wIA~k%V}4CvSqN__Hu^?cRQBt5iOx+5zp(iM*arS zNG}wG=^Z*t;>owI1WM%XM2TXcY#E4R&*!=QS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