Separate global and level indices for call stack tree.

This commit is contained in:
Bartosz Taudul 2018-08-18 02:23:55 +02:00
parent 9cd6d12095
commit 2852784f55

View File

@ -6654,9 +6654,11 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
{ {
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
int lidx = 0;
pdqsort_branchless( tree.begin(), tree.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.allocInclusive > rhs.allocInclusive; } ); pdqsort_branchless( tree.begin(), tree.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.allocInclusive > rhs.allocInclusive; } );
for( auto& v : tree ) for( auto& v : tree )
{ {
idx++;
auto frame = m_worker.GetCallstackFrame( v.frame ); auto frame = m_worker.GetCallstackFrame( v.frame );
bool expand = false; bool expand = false;
if( v.children.empty() ) if( v.children.empty() )
@ -6667,7 +6669,7 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
} }
else else
{ {
ImGui::PushID( idx++ ); ImGui::PushID( lidx++ );
expand = ImGui::TreeNode( m_worker.GetString( frame->name ) ); expand = ImGui::TreeNode( m_worker.GetString( frame->name ) );
ImGui::PopID(); ImGui::PopID();
} }