diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 2e28a81..4f8ec7f 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -421,10 +421,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
421 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | 421 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore |
422 | if (d.SpaceGetNumGeoms(((OdePrim)prim).m_targetSpace) == 0) | 422 | if (d.SpaceGetNumGeoms(((OdePrim)prim).m_targetSpace) == 0) |
423 | { | 423 | { |
424 | d.SpaceRemove(space, ((OdePrim)prim).m_targetSpace); | 424 | if (!(((OdePrim)prim).m_targetSpace.Equals(null))) |
425 | // free up memory used by the space. | 425 | { |
426 | d.SpaceDestroy(((OdePrim)prim).m_targetSpace); | 426 | if (d.GeomIsSpace(((OdePrim)prim).m_targetSpace)) |
427 | resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position)); | 427 | { |
428 | d.SpaceRemove(space, ((OdePrim)prim).m_targetSpace); | ||
429 | // free up memory used by the space. | ||
430 | d.SpaceDestroy(((OdePrim)prim).m_targetSpace); | ||
431 | resetSpaceArrayItemToZero(calculateSpaceArrayItemFromPos(((OdePrim)prim).Position)); | ||
432 | } | ||
433 | } | ||
428 | } | 434 | } |
429 | } | 435 | } |
430 | 436 | ||
@@ -461,8 +467,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
461 | { | 467 | { |
462 | if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0) | 468 | if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0) |
463 | { | 469 | { |
464 | 470 | if (d.GeomIsSpace(currentspace)) | |
465 | d.SpaceRemove(currentspace, geom); | 471 | d.SpaceRemove(currentspace, geom); |
466 | } | 472 | } |
467 | else | 473 | else |
468 | { | 474 | { |
@@ -481,10 +487,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
481 | { | 487 | { |
482 | if (currentspace != (IntPtr)0) | 488 | if (currentspace != (IntPtr)0) |
483 | { | 489 | { |
484 | d.SpaceRemove(space, currentspace); | 490 | if (d.GeomIsSpace(currentspace)) |
485 | // free up memory used by the space. | 491 | { |
486 | d.SpaceDestroy(currentspace); | 492 | d.SpaceRemove(space, currentspace); |
487 | resetSpaceArrayItemToZero(currentspace); | 493 | // free up memory used by the space. |
494 | d.SpaceDestroy(currentspace); | ||
495 | resetSpaceArrayItemToZero(currentspace); | ||
496 | } | ||
488 | } | 497 | } |
489 | } | 498 | } |
490 | } | 499 | } |
@@ -503,7 +512,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
503 | { | 512 | { |
504 | if (sGeomIsIn != (IntPtr)0) | 513 | if (sGeomIsIn != (IntPtr)0) |
505 | { | 514 | { |
506 | d.SpaceRemove(sGeomIsIn, geom); | 515 | if (d.GeomIsSpace(sGeomIsIn)) |
516 | d.SpaceRemove(sGeomIsIn, geom); | ||
507 | } | 517 | } |
508 | } | 518 | } |
509 | } | 519 | } |