Fix regression regarding timers with equal end-time std::set<Key, Comp> stores Key only if Comp(Key) yields a unique result (My mistake: I was under the impression Comp is only used for the ordering). This prevents FbTk::Timers with equal end-times from actually being started. Escpecially in situation with multiple ClockTools this lead to stopped timers (see bug #3600694). Kudos to Adam Majer for enlightening discussions.
Mathias Gumz akira at fluxbox dot org
1 files changed,
6 insertions(+),
2 deletions(-)
jump to
M
src/FbTk/Timer.cc
→
src/FbTk/Timer.cc
@@ -58,8 +58,12 @@
namespace { struct TimerCompare { - bool operator() (const FbTk::Timer* a, const FbTk::Timer* b) { - return a->getEndTime() < b->getEndTime(); + // stable sort order and allows multiple timers to have + // the same end-time + bool operator() (const FbTk::Timer* a, const FbTk::Timer* b) const { + uint64_t ae = a->getEndTime(); + uint64_t be = b->getEndTime(); + return (ae < be) || (ae == be && a < b); } }; typedef std::set<FbTk::Timer*, TimerCompare> TimerList;