From d5760a05ae38b9045b1107c4366166b60b4cd988 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 25 Jul 2026 18:41:46 +0200 Subject: [PATCH] Do not crash on missing symbol data in sample entry stacks window. The window can be opened for a symbol which has no symbol stats or no symbol data. For example, the statistics window can produce clickable rows for symbols that are not present in the symbol map. Close the window instead of dereferencing null pointers. --- profiler/src/profiler/TracyView_Samples.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/profiler/src/profiler/TracyView_Samples.cpp b/profiler/src/profiler/TracyView_Samples.cpp index 08d88091..955f0986 100644 --- a/profiler/src/profiler/TracyView_Samples.cpp +++ b/profiler/src/profiler/TracyView_Samples.cpp @@ -839,6 +839,14 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu void View::DrawSampleParents() { + const auto ss = m_worker.GetSymbolStats( m_sampleParents.symAddr ); + const auto symbol = m_worker.GetSymbolData( m_sampleParents.symAddr ); + if( !ss || !symbol ) + { + m_sampleParents.symAddr = 0; + return; + } + bool show = true; const auto scale = GetScale(); ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 500 * scale ), ImGuiCond_FirstUseEver ); @@ -846,10 +854,8 @@ void View::DrawSampleParents() ImGui::Begin( "Sample entry stacks", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); if( !ImGui::GetCurrentWindowRead()->SkipItems ) { - auto ss = m_worker.GetSymbolStats( m_sampleParents.symAddr ); if( m_sampleParents.statMode == 0 && ss->wasExecuting.empty() ) m_sampleParents.statMode = 1; - const auto symbol = m_worker.GetSymbolData( m_sampleParents.symAddr ); uint64_t total = 0; unordered_flat_map stats; if( m_sampleParents.statMode == 0 )