diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 2f7b8af1..00bb474f 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6500,7 +6500,8 @@ void View::DrawMemory() auto& mem = m_worker.GetMemData(); auto tree = GetCallstackFrameTree( mem ); - DrawFrameTreeLevel( tree ); + int idx = 0; + DrawFrameTreeLevel( tree, idx ); ImGui::TreePop(); } @@ -6508,11 +6509,10 @@ void View::DrawMemory() ImGui::End(); } -void View::DrawFrameTreeLevel( std::vector& tree ) const +void View::DrawFrameTreeLevel( std::vector& tree, int& idx ) const { auto& io = ImGui::GetIO(); - int idx = 0; pdqsort_branchless( tree.begin(), tree.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.allocInclusive > rhs.allocInclusive; } ); for( auto& v : tree ) { @@ -6593,7 +6593,7 @@ void View::DrawFrameTreeLevel( std::vector& tree ) const if( expand ) { - DrawFrameTreeLevel( v.children ); + DrawFrameTreeLevel( v.children, idx ); ImGui::TreePop(); } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index e366c9e4..a6d9bc2d 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -103,7 +103,7 @@ private: void ListMemData( T ptr, T end, std::function DrawAddress, const char* id = nullptr ); std::vector GetCallstackFrameTree( const MemData& mem ) const; - void DrawFrameTreeLevel( std::vector& tree ) const; + void DrawFrameTreeLevel( std::vector& tree, int& idx ) const; void DrawInfoWindow(); void DrawZoneInfoWindow();