diff --git a/server/TracyUserData.cpp b/server/TracyUserData.cpp index 670b29c8..86eff760 100644 --- a/server/TracyUserData.cpp +++ b/server/TracyUserData.cpp @@ -10,6 +10,7 @@ namespace tracy constexpr auto FileDescription = "description"; UserData::UserData() + : m_preserveState( false ) { } @@ -52,6 +53,11 @@ bool UserData::SetDescription( const char* description ) return true; } +void UserData::StateShouldBePreserved() +{ + m_preserveState = true; +} + FILE* UserData::OpenFile( const char* filename, bool write ) { const auto path = GetSavePath( m_program.c_str(), m_time, filename, write ); diff --git a/server/TracyUserData.hpp b/server/TracyUserData.hpp index 6db8bd4f..3bc07943 100644 --- a/server/TracyUserData.hpp +++ b/server/TracyUserData.hpp @@ -20,6 +20,8 @@ public: const std::string& GetDescription() const { return m_description; } bool SetDescription( const char* description ); + void StateShouldBePreserved(); + private: FILE* OpenFile( const char* filename, bool write ); @@ -27,6 +29,8 @@ private: uint64_t m_time; std::string m_description; + + bool m_preserveState; }; } diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 02e0a064..c0b9fa77 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -148,6 +148,7 @@ View::View( FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, InitTextEditor(); SetViewToLastFrames(); + m_userData.StateShouldBePreserved(); } View::~View() @@ -852,6 +853,7 @@ bool View::DrawConnection() } if( f ) { + m_userData.StateShouldBePreserved(); m_saveThreadState.store( SaveThreadState::Saving, std::memory_order_relaxed ); m_saveThread = std::thread( [this, f{std::move( f )}] { std::shared_lock lock( m_worker.GetDataLock() );