diff --git a/server/TracyView.cpp b/server/TracyView.cpp index cb477873..43e42165 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -385,15 +385,19 @@ void View::AddCustomString( uint64_t ptr, std::string&& str ) { auto pit = m_pendingCustomStrings.find( ptr ); assert( pit != m_pendingCustomStrings.end() ); - auto sit = m_customStrings.find( str ); + auto sit = m_customStrings.find( str.c_str() ); if( sit == m_customStrings.end() ) { - pit->second->text = str.c_str(); - m_customStrings.emplace( std::move( str ) ); + const auto sz = str.size(); + auto ptr = new char[sz+1]; + memcpy( ptr, str.c_str(), sz ); + ptr[sz] = '\0'; + pit->second->text = ptr; + m_customStrings.emplace( ptr ); } else { - pit->second->text = sit->c_str(); + pit->second->text = *sit; } m_pendingCustomStrings.erase( pit ); } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 92ec1cd8..5cb7ffda 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -12,6 +12,7 @@ #include "../common/tracy_lz4.hpp" #include "../common/TracySocket.hpp" #include "../common/TracyQueue.hpp" +#include "TracyCharUtil.hpp" #include "TracyEvent.hpp" #include "TracySlab.hpp" #include "TracyVector.hpp" @@ -96,7 +97,7 @@ private: Vector m_threads; std::unordered_map m_strings; std::unordered_map m_threadNames; - std::unordered_set m_customStrings; + std::unordered_set m_customStrings; std::unordered_map m_sourceLocation; uint64_t m_zonesCnt;