Skip to content

Commit

Permalink
Special dart destructor doesn't work with static linking
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Feb 6, 2024
1 parent 45a0de5 commit d440204
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dartsim/src/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class Plugin :
public virtual SimulationFeatures,
public virtual WorldFeatures { };

#ifndef GZ_PHYSICS_BAZEL_BUILD
namespace {

// This is done as a partial fix for
// https://github.com/gazebosim/gz-physics/issues/442. The issue seems like the
// destructors for the concrete collision detectors get unloaded and deleted
Expand All @@ -80,12 +80,20 @@ struct UnregisterCollisionDetectors
{
~UnregisterCollisionDetectors()
{
dart::collision::CollisionDetector::getFactory()->unregisterAllCreators();
/*
auto factory = dart::collision::CollisionDetector::getFactory();
if (factory != nullptr)
{
factory->unregisterAllCreators();
}
*/
}
};

UnregisterCollisionDetectors unregisterAtUnload;
}
} // namespace
#endif // GZ_PHYSICS_BAZEL_BUILD

GZ_PHYSICS_ADD_PLUGIN(Plugin, FeaturePolicy3d, DartsimFeatures)

Expand Down

0 comments on commit d440204

Please sign in to comment.