diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 7587316b..fcfe7929 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -541,7 +541,7 @@ void View::DispatchProcess( const QueueItem& ev, char*& ptr ) AddThreadString( ev.stringTransfer.ptr, ptr, sz ); break; case QueueType::PlotName: - HandlePlotName( ev.stringTransfer.ptr, std::string( ptr, ptr+sz ) ); + HandlePlotName( ev.stringTransfer.ptr, ptr, sz ); break; case QueueType::MessageData: AddMessageData( ev.stringTransfer.ptr, ptr, sz ); @@ -1209,20 +1209,22 @@ void View::InsertPlot( PlotData* plot, PlotItem* item ) } } -void View::HandlePlotName( uint64_t name, std::string&& str ) +void View::HandlePlotName( uint64_t name, char* str, size_t sz ) { auto pit = m_pendingPlots.find( name ); assert( pit != m_pendingPlots.end() ); - auto it = m_plotRev.find( str ); + const auto sl = StoreString( str, sz ); + + auto it = m_plotRev.find( sl.ptr ); if( it == m_plotRev.end() ) { const auto idx = m_plots.size(); m_plotMap.emplace( name, idx ); - m_plotRev.emplace( str, idx ); + m_plotRev.emplace( sl.ptr, idx ); std::lock_guard lock( m_lock ); m_plots.push_back( pit->second ); - //m_strings.emplace( name, std::move( str ) ); + m_strings.emplace( name, sl.ptr ); } else { diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 001324a7..9f9edaf0 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -173,7 +173,7 @@ private: void InsertPlot( PlotData* plot, int64_t time, double val ); void InsertPlot( PlotData* plot, PlotItem* item ); - void HandlePlotName( uint64_t name, std::string&& str ); + void HandlePlotName( uint64_t name, char* str, size_t sz ); void HandlePostponedPlots(); int64_t GetFrameTime( size_t idx ) const; @@ -259,7 +259,7 @@ private: std::unordered_map m_pendingCustomStrings; std::unordered_map m_threadMap; std::unordered_map m_plotMap; - std::unordered_map m_plotRev; + std::unordered_map m_plotRev; std::unordered_map m_pendingPlots; std::unordered_map m_pendingMessages; std::unordered_map m_sourceLocationShrink;