From 833151b868b755017faf2e7766004cc8a9c0b7aa Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 16 Mar 2019 02:36:58 +0100 Subject: [PATCH] Don't search for lock events outside of thread range. --- server/TracyView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index caa15d55..72496470 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3156,8 +3156,8 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, const auto thread = it->second; const auto threadBit = GetThreadBit( thread ); - auto vbegin = std::lower_bound( tl.begin(), tl.end(), m_zvStart - delay, [] ( const auto& l, const auto& r ) { return l->time < r; } ); - const auto vend = std::lower_bound( vbegin, tl.end(), m_zvEnd + resolution, [] ( const auto& l, const auto& r ) { return l->time < r; } ); + auto vbegin = std::lower_bound( tl.begin(), tl.end(), std::max( range.start, m_zvStart - delay ), [] ( const auto& l, const auto& r ) { return l->time < r; } ); + const auto vend = std::lower_bound( vbegin, tl.end(), std::min( range.end, m_zvEnd + resolution ), [] ( const auto& l, const auto& r ) { return l->time < r; } ); if( vbegin > tl.begin() ) vbegin--;