Add missing locks.

This commit is contained in:
Bartosz Taudul 2017-10-04 16:07:20 +02:00
parent e7e41f1e5c
commit ff21b74e7a

View File

@ -419,7 +419,7 @@ void View::ProcessFrameMark( const QueueFrameMark& ev )
const auto lastframe = m_frames.back(); const auto lastframe = m_frames.back();
const auto time = ev.time * m_timerMul; const auto time = ev.time * m_timerMul;
assert( lastframe < time ); assert( lastframe < time );
std::unique_lock<std::mutex> lock( m_lock ); std::lock_guard<std::mutex> lock( m_lock );
m_frames.push_back( time ); m_frames.push_back( time );
} }
@ -437,6 +437,7 @@ void View::ProcessZoneName( const QueueZoneName& ev )
assert( !stack.empty() ); assert( !stack.empty() );
auto zone = stack.back(); auto zone = stack.back();
CheckString( ev.name ); CheckString( ev.name );
std::lock_guard<std::mutex> lock( m_lock );
GetTextData( *zone )->zoneName = ev.name; GetTextData( *zone )->zoneName = ev.name;
} }
@ -502,6 +503,7 @@ void View::AddCustomString( uint64_t ptr, std::string&& str )
{ {
auto pit = m_pendingCustomStrings.find( ptr ); auto pit = m_pendingCustomStrings.find( ptr );
assert( pit != m_pendingCustomStrings.end() ); assert( pit != m_pendingCustomStrings.end() );
std::unique_lock<std::mutex> lock( m_lock );
auto sit = m_customStrings.find( str.c_str() ); auto sit = m_customStrings.find( str.c_str() );
if( sit == m_customStrings.end() ) if( sit == m_customStrings.end() )
{ {
@ -516,6 +518,7 @@ void View::AddCustomString( uint64_t ptr, std::string&& str )
{ {
GetTextData( *pit->second )->userText = *sit; GetTextData( *pit->second )->userText = *sit;
} }
lock.unlock();
m_pendingCustomStrings.erase( pit ); m_pendingCustomStrings.erase( pit );
} }