From 52d24d0d4c8c7314c2145e82f837a56419049ca4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 13 Sep 2017 23:36:40 +0200 Subject: [PATCH] s_instance ptr may be accessed by thread. --- client/TracyProfiler.cpp | 5 +++-- server/TracyView.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 315e3c25..05ffc17e 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -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() diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1568b54d..6f9e6339 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -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()