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.
This commit is contained in:
Mathias Gumz 2013-02-01 20:36:20 +01:00
parent dc47491533
commit 3e4ee48bf1

View file

@ -58,8 +58,12 @@
namespace { namespace {
struct TimerCompare { struct TimerCompare {
bool operator() (const FbTk::Timer* a, const FbTk::Timer* b) { // stable sort order and allows multiple timers to have
return a->getEndTime() < b->getEndTime(); // 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; typedef std::set<FbTk::Timer*, TimerCompare> TimerList;