From: david Date: Sun, 22 Dec 2002 19:57:09 +0000 (+0000) Subject: Use SGPropertyNode_ptr and add a private copy constructor, both for X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c2fb92a92278313ca5faefa4e6c7e4dc9dbe976;p=flightgear.git Use SGPropertyNode_ptr and add a private copy constructor, both for safety's sake. --- diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 66ae607f8..f5ccdfa5a 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -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 diff --git a/src/Input/input.hxx b/src/Input/input.hxx index 007e70a93..491c0a2ca 100644 --- a/src/Input/input.hxx +++ b/src/Input/input.hxx @@ -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; };