]> git.mxchange.org Git - flightgear.git/commitdiff
- complain about attempts to attach a listener to a tied node
authormfranz <mfranz>
Sun, 16 Jul 2006 11:30:33 +0000 (11:30 +0000)
committermfranz <mfranz>
Sun, 16 Jul 2006 11:30:33 +0000 (11:30 +0000)
- do *not* complain about a listener writing to its own node, but don't
  enter recursion either

src/Scripting/NasalSys.cxx

index 721614da7df6f1c6bc86417540ce2b71103b4636..d37857cecee13562d4d95147e3a7ff7c75f7108c 100644 (file)
@@ -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();