opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
758 stars 308 forks source link

`prescribeControlForActuator()` can cause crashes in scripting when ownership is handed to the `Controller` #3750

Closed carmichaelong closed 1 month ago

carmichaelong commented 3 months ago

(Example files: PrescribedControllerExample.zip)

Example shows a use case in passing a pointer to a spline from a GCVSplineSet to a Controller using prescribeControlForActuator(). When garbage collection occurs, this causes a crash.

Cloning the spline in the call to prescribeControlForActuator() works around this issue.

/cc @aymanhab