Skip to content

Commit

Permalink
[mechanics] Fix BulletSpaceFilter destructor segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
radarsat1 committed Feb 19, 2016
1 parent e045e95 commit 83ce528
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mechanics/src/contactDetection/bullet/BulletSpaceFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ BulletSpaceFilter::BulletSpaceFilter(SP::Model model) :

}

BulletSpaceFilter::~BulletSpaceFilter()
{
// btCollisionObjects contain pointers to _broadphase (so-called
// "broadphase handles") that are referenced during the
// _collisionWorld destructor, therefore if _broadphase is
// destroyed too early we get a segfault. Avoid this by
// explicitly destroying _collisionWorld before automatic
// shared_ptr destruction.
_collisionWorld.reset();
}

void BulletSpaceFilter::setCollisionConfiguration(
SP::btDefaultCollisionConfiguration collisionConfig)
{
Expand Down
4 changes: 4 additions & 0 deletions mechanics/src/contactDetection/bullet/BulletSpaceFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class BulletSpaceFilter : public SpaceFilter
public:
BulletSpaceFilter(SP::Model model);

/** Destructor.
*/
virtual ~BulletSpaceFilter();

/** get Bullet collision configuration
\return a pointer on a Bullet collision configuration
*/
Expand Down

0 comments on commit 83ce528

Please sign in to comment.