From 1841bd7343f7d391de689cb29d9cf93577360de0 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 16 Jul 2006 11:30:33 +0000 Subject: [PATCH] - 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 --- src/Scripting/NasalSys.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 721614da7..d37857cec 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -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(); -- 2.39.5