1
0
Fork 0

Use SGPropertyNode_ptr and add a private copy constructor, both for

safety's sake.
This commit is contained in:
david 2002-12-22 19:57:09 +00:00
parent 0111183153
commit 5c2fb92a92
2 changed files with 9 additions and 14 deletions

View file

@ -89,27 +89,21 @@ FGBinding::FGBinding ()
}
FGBinding::FGBinding (const SGPropertyNode * node)
: _command(0),
_arg(new SGPropertyNode),
_setting(0)
{
FGBinding();
read(node);
}
FGBinding::~FGBinding ()
{
// delete _arg; // Delete the saved arguments
// delete _command_state; // Delete the saved command state
}
void
FGBinding::read (const SGPropertyNode * node)
{
const SGPropertyNode * conditionNode = node->getChild("condition");
if (conditionNode != 0) {
cerr << "Adding condition to binding" << endl;
if (conditionNode != 0)
setCondition(fgReadCondition(conditionNode));
}
_command_name = node->getStringValue("command", "");
if (_command_name.empty()) {
@ -125,10 +119,7 @@ FGBinding::read (const SGPropertyNode * node)
return;
}
delete _arg;
_arg = new SGPropertyNode;
_setting = 0;
copyProperties(node, _arg); // FIXME: don't use whole node!!!
_arg = (SGPropertyNode *)node;
}
void

View file

@ -139,10 +139,14 @@ public:
private:
// just to be safe.
FGBinding (const FGBinding &binding);
string _command_name;
SGCommandMgr::command_t _command;
mutable SGPropertyNode * _arg;
mutable SGPropertyNode * _setting;
mutable SGPropertyNode_ptr _arg;
mutable SGPropertyNode_ptr _setting;
};