- complain about attempts to attach a listener to a tied node
- do *not* complain about a listener writing to its own node, but don't enter recursion either
This commit is contained in:
parent
a952ed210f
commit
1841bd7343
1 changed files with 9 additions and 4 deletions
|
@ -656,6 +656,12 @@ naRef FGNasalSys::setListener(int argc, naRef* args)
|
|||
else if(naIsGhost(prop)) node = *(SGPropertyNode_ptr*)naGhost_ptr(prop);
|
||||
else return naNil();
|
||||
|
||||
if (node->isTied()) {
|
||||
naRuntimeError(_context, "cannot attach listener to tied property %s",
|
||||
node->getPath());
|
||||
return naNil();
|
||||
}
|
||||
|
||||
naRef handler = argc > 1 ? args[1] : naNil();
|
||||
if(!(naIsCode(handler) || naIsCCode(handler) || naIsFunc(handler)))
|
||||
return naNil();
|
||||
|
@ -710,11 +716,10 @@ FGNasalListener::~FGNasalListener()
|
|||
|
||||
void FGNasalListener::valueChanged(SGPropertyNode* node)
|
||||
{
|
||||
if (_active) {
|
||||
SG_LOG(SG_NASAL, SG_ALERT, "Recursive listener call "
|
||||
"on property " << node->getPath());
|
||||
// drop recursive listener calls
|
||||
if (_active)
|
||||
return;
|
||||
}
|
||||
|
||||
_active++;
|
||||
_nas->_cmdArg = node;
|
||||
naContext c = naNewContext();
|
||||
|
|
Loading…
Add table
Reference in a new issue