Closed adamkewley closed 8 months ago
LGTM 👍
Thanks for reading into this @tkuchida - I'll merge it after I do one last check on setDocument
: one thing I'm realizing is that setDocument
's old semantics are purely referential/leaky whereas the new one assumes control over whatever it receives, which might alter behavior
Sounds good, @adamkewley. (All tests are passing, so if a revision is required, I recommend beefing up :cow: the test cases to cover the difference.)
All uses of setDocument
in the opensim-core
tree are fine. E.g.:
OpenSim/Tools/InverseDynamicsTool.cpp:624: setDocument(new XMLDocument(newFileName));
OpenSim/Tools/InverseKinematicsTool.cpp:361: setDocument(new XMLDocument(newFileName));
OpenSim/Tools/InverseKinematicsTool.cpp:395: setDocument(new XMLDocument(newFileName));
Quick search through a spattering of open-source OpenSim API projects:
opensim-org/opensim-gui
contains no references to it (it does contain references to a setDocument
symbol, but it's for InstructionsTopComponent.java
, no OpenSim::Model
ComputationalBiomechanicsLab/opensim-creator
contains no references to ittgeijten/scone-core
contains no references to itrcnl-org/nmsm-core
contains no references to itperfanalytics/pose2sim
: no references to itSo I think it's safe to assume that adding unconditional ownership to the setDocument
API (as in, the previous version would always leak any overwritten XMLDocument
) is probably ok... probably.
Fixes nit
Brief summary of changes
Object::_document
to ashared_ptr
to clarify memory handlingTesting I've completed
Looking for feedback on...
CHANGELOG.md (choose one)
This change is