From e8db86d09206a6038a1cc623b40b0939bcd2cbc2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 18 Dec 2019 13:33:01 +0100 Subject: [PATCH] Implement ZoneText() string merging. --- server/TracyWorker.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index e5032932..6ad51490 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3778,7 +3778,22 @@ void Worker::ProcessZoneText( const QueueZoneText& ev ) auto zone = stack.back(); auto it = m_pendingCustomStrings.find( ev.text ); assert( it != m_pendingCustomStrings.end() ); - zone->text = StringIdx( it->second.idx ); + if( !zone->text.Active() ) + { + zone->text = StringIdx( it->second.idx ); + } + else + { + const auto str0 = GetString( zone->text ); + const auto str1 = it->second.ptr; + const auto len0 = strlen( str0 ); + const auto len1 = strlen( str1 ); + char* buf = (char*)alloca( len0+len1+1 ); + memcpy( buf, str0, len0 ); + buf[len0] = '\n'; + memcpy( buf+len0+1, str1, len1 ); + zone->text = StringIdx( StoreString( buf, len0+len1+1 ).idx ); + } m_pendingCustomStrings.erase( it ); }