Fix issue with missing lock display.

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.
This commit is contained in:
Bartosz Taudul 2017-10-06 18:53:11 +02:00
parent 34030bf3d4
commit 42595014a1

View File

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