diff --git a/profiler/src/profiler/TracyManualData.cpp b/profiler/src/profiler/TracyManualData.cpp index 3b313be5..738d8a92 100644 --- a/profiler/src/profiler/TracyManualData.cpp +++ b/profiler/src/profiler/TracyManualData.cpp @@ -115,4 +115,10 @@ void TracyManualData::AddManualChunk( const std::string_view& manual, int start, } } +const TracyManualData& GetManualData() +{ + static TracyManualData data; + return data; +} + } diff --git a/profiler/src/profiler/TracyManualData.hpp b/profiler/src/profiler/TracyManualData.hpp index 08c7c58a..74dd9b8b 100644 --- a/profiler/src/profiler/TracyManualData.hpp +++ b/profiler/src/profiler/TracyManualData.hpp @@ -34,6 +34,8 @@ private: uint64_t m_hash; }; +const TracyManualData& GetManualData(); + } #endif diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 1252f898..e70fca7e 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -54,13 +54,13 @@ View::View( void(*cbMainThread)(const std::function&, bool), const char* , m_achievements( s_config.achievements ) , m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier ) , m_verticalScrollMultiplier( s_config.verticalScrollMultiplier ) - , m_manualData( std::make_shared() ) + , m_manualData( GetManualData() ) , m_markdown( this, &m_worker ) #ifdef __EMSCRIPTEN__ , m_td( 2, "ViewMt" ) #else , m_td( std::thread::hardware_concurrency(), "ViewMt" ) - , m_llm( m_worker, *this, *m_manualData ) + , m_llm( m_worker, *this, m_manualData ) #endif { InitTextEditor(); @@ -86,13 +86,13 @@ View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f , m_achievements( s_config.achievements ) , m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier ) , m_verticalScrollMultiplier( s_config.verticalScrollMultiplier ) - , m_manualData( std::make_shared() ) + , m_manualData( GetManualData() ) , m_markdown( this, &m_worker ) #ifdef __EMSCRIPTEN__ , m_td( 2, "ViewMt" ) #else , m_td( std::thread::hardware_concurrency(), "ViewMt" ) - , m_llm( m_worker, *this, *m_manualData ) + , m_llm( m_worker, *this, m_manualData ) #endif { m_notificationTime = 4; diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index 57f56ef1..29088e39 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -1083,7 +1083,7 @@ private: double m_horizontalScrollMultiplier = 1.0; double m_verticalScrollMultiplier = 1.0; - std::shared_ptr m_manualData; + const TracyManualData& m_manualData; size_t m_activeManualChunk = 0; Markdown m_markdown; diff --git a/profiler/src/profiler/TracyView_Manual.cpp b/profiler/src/profiler/TracyView_Manual.cpp index a2671b2f..bdc084b9 100644 --- a/profiler/src/profiler/TracyView_Manual.cpp +++ b/profiler/src/profiler/TracyView_Manual.cpp @@ -41,7 +41,7 @@ void View::DrawManual() ImGui::BeginChild( "##toc", ImVec2( 0, 0 ), ImGuiChildFlags_AlwaysUseWindowPadding ); int level = 0; - auto& chunks = m_manualData->GetChunks(); + auto& chunks = m_manualData.GetChunks(); assert( !chunks.empty() ); for( size_t i=0; iGetChunks(); + auto& chunks = m_manualData.GetChunks(); auto it = std::ranges::find_if( chunks, [anchor]( const auto& chunk ) { return chunk.link == anchor; } ); if( it != chunks.end() ) return &*it; return nullptr; @@ -173,7 +172,7 @@ bool View::ViewManualChunk( const char* anchor ) assert( anchor && *anchor ); const auto chunk = GetManualChunk( anchor ); if( !chunk ) return false; - m_activeManualChunk = std::distance( m_manualData->GetChunks().data(), chunk ); + m_activeManualChunk = std::distance( m_manualData.GetChunks().data(), chunk ); m_showManual = true; m_manualPositionReset = true; return true;