[MOD] STR #3532: timeout set by Fl::add_timeout elapses too early
Matthias Meixner
Jan 17, 2020
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: https://www.fltk.org/str.php?L3532
Version: 1.3.5
A timeout set by Fl::add_timeout elapses too early, if a previous timeout
was processed with delay.
The reason is that add_timeout() internally uses repeat_timeout() to add
the new timeout but repeat_timeout() adds missed_timeout_by to the selected
timeout, which is wrong in case of add_timeout(). If the last timeout was
processed with delay, the timeout set by add_timeout() will elapse too
early.
Changing add_timeout in Fl.cxx as follows fixes the issue:
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
elapse_timeouts();
double miss=missed_timeout_by;
missed_timeout_by=0;
repeat_timeout(time, cb, argp);
missed_timeout_by=miss;
}
Link: https://www.fltk.org/str.php?L3532
Version: 1.3.5
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.