From df96293477dfe08d972acd981bda1e4f26bf2bba Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 29 Jan 2022 15:45:25 +0100 Subject: [PATCH] Create GPU source location zones stats entry, if not present. In case of CPU statistics data, this entry is created during creation of a source location. This won't be done for GPU zones, as it would needlessly expand the number of held entries. This is assuming the number of GPU zones is significantly less than the number of CPU zones. --- server/TracyWorker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index bceda806..af4ef323 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3786,7 +3786,10 @@ Worker::SourceLocationZones* Worker::GetSourceLocationZonesReal( uint16_t srcloc Worker::GpuSourceLocationZones* Worker::GetGpuSourceLocationZonesReal( uint16_t srcloc ) { auto it = m_data.gpuSourceLocationZones.find( srcloc ); - assert( it != m_data.gpuSourceLocationZones.end() ); + if( it == m_data.gpuSourceLocationZones.end() ) + { + it = m_data.gpuSourceLocationZones.emplace( srcloc, GpuSourceLocationZones() ).first; + } m_data.gpuZonesLast.first = srcloc; m_data.gpuZonesLast.second = &it->second; return &it->second;