Use SimTK::ReferencePtr and its methods instead of plain pointer to maintain _nextComponent.