diff --git a/server/TracyView.cpp b/server/TracyView.cpp index ad0208fb..23e83179 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -12059,7 +12059,10 @@ static tracy_force_inline CallstackFrameTree* GetFrameTreeItemNoGroup( flat_hash static tracy_force_inline CallstackFrameTree* GetFrameTreeItemGroup( flat_hash_map>& tree, CallstackFrameId idx, const Worker& worker ) { - auto& frameData = *worker.GetCallstackFrame( idx ); + auto frameDataPtr = worker.GetCallstackFrame( idx ); + if( !frameDataPtr ) return nullptr; + + auto& frameData = *frameDataPtr; auto& frame = frameData.data[frameData.size-1]; auto fidx = frame.name.Idx(); @@ -12132,16 +12135,19 @@ flat_hash_map> View::GetCallstack auto base = cs.back(); auto treePtr = GetFrameTreeItemGroup( root, base, m_worker ); - treePtr->count += path.second.cnt; - treePtr->alloc += path.second.mem; - treePtr->callstacks.emplace( path.first ); - - for( int i = int( cs.size() ) - 2; i >= 0; i-- ) + if( treePtr ) { - treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker ); treePtr->count += path.second.cnt; treePtr->alloc += path.second.mem; treePtr->callstacks.emplace( path.first ); + for( int i = int( cs.size() ) - 2; i >= 0; i-- ) + { + treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker ); + if( !treePtr ) break; + treePtr->count += path.second.cnt; + treePtr->alloc += path.second.mem; + treePtr->callstacks.emplace( path.first ); + } } } } @@ -12182,16 +12188,20 @@ flat_hash_map> View::GetCallstack auto base = cs.front(); auto treePtr = GetFrameTreeItemGroup( root, base, m_worker ); - treePtr->count += path.second.cnt; - treePtr->alloc += path.second.mem; - treePtr->callstacks.emplace( path.first ); - - for( int i = 1; i < cs.size(); i++ ) + if( treePtr ) { - treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker ); treePtr->count += path.second.cnt; treePtr->alloc += path.second.mem; treePtr->callstacks.emplace( path.first ); + + for( int i = 1; i < cs.size(); i++ ) + { + treePtr = GetFrameTreeItemGroup( treePtr->children, cs[i], m_worker ); + if( !treePtr ) break; + treePtr->count += path.second.cnt; + treePtr->alloc += path.second.mem; + treePtr->callstacks.emplace( path.first ); + } } } } @@ -12698,92 +12708,96 @@ void View::DrawFrameTreeLevel( const flat_hash_mapsecond; idx++; - auto& frameData = *m_worker.GetCallstackFrame( v.frame ); - auto frame = frameData.data[frameData.size-1]; - bool expand = false; - if( v.children.empty() ) + auto frameDataPtr = m_worker.GetCallstackFrame( v.frame ); + if( frameDataPtr ) { - ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() ); - ImGui::TextUnformatted( m_worker.GetString( frame.name ) ); - ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() ); - } - else - { - ImGui::PushID( lidx++ ); - if( tree.size() == 1 ) + auto& frameData = *frameDataPtr; + auto frame = frameData.data[frameData.size-1]; + bool expand = false; + if( v.children.empty() ) { - expand = ImGui::TreeNodeEx( m_worker.GetString( frame.name ), ImGuiTreeNodeFlags_DefaultOpen ); + ImGui::Indent( ImGui::GetTreeNodeToLabelSpacing() ); + ImGui::TextUnformatted( m_worker.GetString( frame.name ) ); + ImGui::Unindent( ImGui::GetTreeNodeToLabelSpacing() ); } else { - expand = ImGui::TreeNode( m_worker.GetString( frame.name ) ); - } - ImGui::PopID(); - } - - if( ImGui::IsItemClicked( 1 ) ) - { - auto& mem = m_worker.GetMemData().data; - const auto sz = mem.size(); - m_memInfo.showAllocList = true; - m_memInfo.allocList.clear(); - for( size_t i=0; i