On Friday 20 January 2006 09:39, Melchior FRANZ wrote:
> If you want to listen to a property that changes several times
> per frame, then a simple settimer loop is the best thing to do.
> A timer value of 0 makes sure that the function is run once per
> frame. Otherwise (and if the property is not tied!) a listener
> function is the way to go.
Yeah, I have quite a few other timers running at various resolutions already,
but for these switches I think the listeners sound ideal. Unless someone
gets a kick out of flicking various autopilot controls on and off tens of
times per second it should be fine :-)
> autopilot_pitch = func {
> new_ap_pitch = cmdarg().getValue();
> ...
> }
> setlistener("sim/model/lightning/controls/flight/ap_pitch",
> autopilot_pitch);
OK, thanks, I understand that fine. And it works exactly as planned if I
change the value myself in the property browser... but causes a segfault if I
flick the switch in the cockpit :-( The switch is bound to a nasal function
which flips a requested property between 1 and 0...
When called separately the toggle function works perfectly, and the listener
function also works perfectly... but when one causes the other to be called
there's a segfault.
#0 0x08496cb8 in naCall ()
#1 0x083afdc9 in FGNasalSys::handleCommand (this=0xbc388a8, arg=0xa73e608) at
NasalSys.cxx:540
#2 0x08059f6b in do_nasal (arg=0x7ff56789) at fg_commands.cxx:183
#3 0x082b7580 in FGBinding::fire (this=0xa73e7e0) at SGSharedPtr.hxx:74
#4 0x080f549b in FGPanelAction::doAction (this=0xa73e270, updown=0) at
stl_vector.h:462
#5 0x080f4b8b in FGPanelInstrument::doMouseAction (this=0xa73c1b8, button=0,
updown=0, x=-165, y=24)
at stl_iterator.h:614
Any ideas?
Cheers,
AJ
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel