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--;