s_instance ptr may be accessed by thread.

This commit is contained in:
Bartosz Taudul 2017-09-13 23:36:40 +02:00
parent 037a4d7fac
commit 52d24d0d4c
2 changed files with 6 additions and 5 deletions

View File

@ -37,11 +37,12 @@ Profiler::Profiler()
Profiler::~Profiler()
{
m_shutdown.store( true, std::memory_order_relaxed );
m_thread.join();
assert( s_instance );
s_instance = nullptr;
m_shutdown.store( true, std::memory_order_relaxed );
m_thread.join();
}
uint64_t Profiler::GetNewId()

View File

@ -28,11 +28,11 @@ View::View( const char* addr )
View::~View()
{
assert( s_instance != nullptr );
s_instance = nullptr;
m_shutdown.store( true, std::memory_order_relaxed );
m_thread.join();
assert( s_instance != nullptr );
s_instance = nullptr;
}
bool View::ShouldExit()