@@ -49,10 +49,7 @@ Controller::Controller() :
49
49
_numControls{0 },
50
50
_actuatorSet{}
51
51
{
52
- setAuthors (" Ajay Seth, Frank Anderson, Chand John, Samuel Hamner" );
53
- constructProperty_enabled (true );
54
- constructProperty_actuator_list ();
55
- _actuatorSet.setMemoryOwner (false );
52
+ constructProperties ();
56
53
}
57
54
58
55
Controller::Controller (Controller const & src) :
@@ -62,11 +59,16 @@ Controller::Controller(Controller const& src) :
62
59
_numControls{src._numControls },
63
60
_actuatorSet{}
64
61
{
62
+ // care: the reason this custom copy constructor exists is to prevent
63
+ // a memory leak (#3247)
65
64
_actuatorSet.setMemoryOwner (false );
66
65
}
67
66
68
67
Controller& Controller::operator =(Controller const & src)
69
68
{
69
+ // care: the reason this custom copy assignment exists is to prevent
70
+ // a memory leak (#3247)
71
+
70
72
if (&src != this )
71
73
{
72
74
static_cast <ModelComponent&>(*this ) = static_cast <ModelComponent const &>(src);
@@ -86,6 +88,17 @@ Controller::~Controller() noexcept = default;
86
88
// _____________________________________________________________________________
87
89
// _____________________________________________________________________________
88
90
91
+ /* *
92
+ * Connect properties to local pointers.
93
+ */
94
+ void Controller::constructProperties ()
95
+ {
96
+ setAuthors (" Ajay Seth, Frank Anderson, Chand John, Samuel Hamner" );
97
+ constructProperty_enabled (true );
98
+ constructProperty_actuator_list ();
99
+ _actuatorSet.setMemoryOwner (false );
100
+ }
101
+
89
102
void Controller::updateFromXMLNode (SimTK::Xml::Element& node,
90
103
int versionNumber) {
91
104
if (versionNumber < XMLDocument::getLatestVersion ()) {
0 commit comments