Mercurial > hg > svcore
diff base/EventSeries.cpp @ 1798:13bd41bd8a17
Some work on making Model classes thread-safe in typical use - and documenting this. Some of the implementations are simpler now that EventSeries is thread-safe
author | Chris Cannam |
---|---|
date | Tue, 01 Oct 2019 11:22:48 +0100 |
parents | ff8c57c364a0 |
children | c546429d4c2f |
line wrap: on
line diff
--- a/base/EventSeries.cpp Tue Oct 01 11:21:56 2019 +0100 +++ b/base/EventSeries.cpp Tue Oct 01 11:22:48 2019 +0100 @@ -544,8 +544,7 @@ EventSeries::getEventByIndex(int index) const { QMutexLocker locker(&m_mutex); - - if (index < 0 || index >= count()) { + if (!in_range_for(m_events, index)) { throw std::logic_error("index out of range"); } return m_events[index]; @@ -555,7 +554,6 @@ EventSeries::getIndexForEvent(const Event &e) const { QMutexLocker locker(&m_mutex); - auto pitr = lower_bound(m_events.begin(), m_events.end(), e); auto d = distance(m_events.begin(), pitr); if (d < 0 || d > INT_MAX) return 0;