Skip to content

Commit 3a43da7

Browse files
authored
Merge pull request #152 from robotpy/release-shuffleboard
Release shuffleboard data on interpreter exit
2 parents f27a714 + a1c3f35 commit 3a43da7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

subprojects/robotpy-wpilib/wpilib/simulation/simulation.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,13 @@ RPYBUILD_PYBIND11_MODULE(m) {
3737
m.def("_resetWpilibSimulationData", &resetWpilibSimulationData,
3838
release_gil());
3939
m.def("_resetMotorSafety", &resetMotorSafety, release_gil());
40+
41+
#ifndef __FRC_ROBORIO__
42+
// ensure that the shuffleboard data is released when python shuts down
43+
static int unused; // the capsule needs something to reference
44+
py::capsule cleanup(&unused, [](void *) {
45+
frc::impl::ResetShuffleboardInstance();
46+
});
47+
m.add_object("_sf_cleanup", cleanup);
48+
#endif
4049
}

0 commit comments

Comments
 (0)