* Copy/SpaceBorder Fix attempt number 3, hopefully the last

afrisby
Teravus Ovares 2007-11-18 20:45:47 +00:00
parent 3bb4cd51fd
commit 694bab9513
1 changed files with 21 additions and 11 deletions

View File

@ -421,10 +421,16 @@ namespace OpenSim.Region.Physics.OdePlugin
//If there are no more geometries in the sub-space, we don't need it in the main space anymore //If there are no more geometries in the sub-space, we don't need it in the main space anymore
if (d.SpaceGetNumGeoms(((OdePrim)prim).m_targetSpace) == 0) if (d.SpaceGetNumGeoms(((OdePrim)prim).m_targetSpace) == 0)
{ {
d.SpaceRemove(space, ((OdePrim)prim).m_targetSpace); if (!(((OdePrim)prim).m_targetSpace.Equals(null)))
// free up memory used by the space. {
d.SpaceDestroy(((OdePrim)prim).m_targetSpace); if (d.GeomIsSpace(((OdePrim)prim).m_targetSpace))
resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position)); {
d.SpaceRemove(space, ((OdePrim)prim).m_targetSpace);
// free up memory used by the space.
d.SpaceDestroy(((OdePrim)prim).m_targetSpace);
resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position));
}
}
} }
} }
@ -461,8 +467,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0) if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0)
{ {
if (d.GeomIsSpace(currentspace))
d.SpaceRemove(currentspace, geom); d.SpaceRemove(currentspace, geom);
} }
else else
{ {
@ -481,10 +487,13 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (currentspace != (IntPtr)0) if (currentspace != (IntPtr)0)
{ {
d.SpaceRemove(space, currentspace); if (d.GeomIsSpace(currentspace))
// free up memory used by the space. {
d.SpaceDestroy(currentspace); d.SpaceRemove(space, currentspace);
resetSpaceArrayItemToZero(currentspace); // free up memory used by the space.
d.SpaceDestroy(currentspace);
resetSpaceArrayItemToZero(currentspace);
}
} }
} }
} }
@ -503,7 +512,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (sGeomIsIn != (IntPtr)0) if (sGeomIsIn != (IntPtr)0)
{ {
d.SpaceRemove(sGeomIsIn, geom); if (d.GeomIsSpace(sGeomIsIn))
d.SpaceRemove(sGeomIsIn, geom);
} }
} }
} }