From 42595014a15b7fc3be91c241d68841e22118f661 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 6 Oct 2017 18:53:11 +0200 Subject: [PATCH] Fix issue with missing lock display. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was caused by a logic error concerning a lock state when thread t1 was waiting for a lock, thread t2 released the lock and thread t1 didn't yet acquire a lock. High zoom level was needed. (Threads are performing Wait, Obtain, Release operations on locks.) t1 W |O R t2 WO R| --------------+----> t ↑ Problem In the region marked by the problem line the lock count was 0, which didn't trigger the appropriate code branch. --- server/TracyView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 66135601..5fc9fb9c 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -1535,10 +1535,12 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, auto vbegin = std::lower_bound( tl.begin(), tl.end(), m_zvStart - m_delay, [] ( const auto& l, const auto& r ) { return l->time < r; } ); const auto vend = std::lower_bound( tl.begin(), tl.end(), m_zvEnd + m_resolution, [] ( const auto& l, const auto& r ) { return l->time < r; } ); + auto blc = (*vbegin)->lockCount; + auto bth = (*vbegin)->thread; if( vbegin > tl.begin() ) vbegin--; State state = State::Nothing; - if( (*vbegin)->lockCount > 0 ) + if( (*vbegin)->lockCount > 0 || ( blc > 0 && bth == tid ) ) { auto it = vbegin; bool waiting = (*vbegin)->waitCount > 0;