1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Fix non-unique child ids in memory window.

This commit is contained in:
Bartosz Taudul 2018-06-22 00:10:00 +02:00
parent d716195afa
commit 3404d191f0
2 changed files with 5 additions and 5 deletions

View File

@ -4827,13 +4827,13 @@ void View::DrawCallstackWindow()
} }
template<class T> template<class T>
void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress ) void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress, const char* id )
{ {
const auto& style = ImGui::GetStyle(); const auto& style = ImGui::GetStyle();
const auto dist = std::distance( ptr, end ) + 1; const auto dist = std::distance( ptr, end ) + 1;
const auto ty = ImGui::GetTextLineHeight() + style.ItemSpacing.y; const auto ty = ImGui::GetTextLineHeight() + style.ItemSpacing.y;
ImGui::BeginChild( "##memScroll", ImVec2( 0, std::max( ty * std::min<int64_t>( dist, 5 ), std::min( ty * dist, ImGui::GetContentRegionAvail().y ) ) ) ); ImGui::BeginChild( id ? id : "##memScroll", ImVec2( 0, std::max( ty * std::min<int64_t>( dist, 5 ), std::min( ty * dist, ImGui::GetContentRegionAvail().y ) ) ) );
ImGui::Columns( 8 ); ImGui::Columns( 8 );
ImGui::Text( "Address" ); ImGui::Text( "Address" );
ImGui::NextColumn(); ImGui::NextColumn();
@ -5179,7 +5179,7 @@ void View::DrawMemory()
ImGui::Text( "0x%" PRIx64 "+%" PRIu64, v->ptr, m_memInfo.ptrFind - v->ptr ); ImGui::Text( "0x%" PRIx64 "+%" PRIu64, v->ptr, m_memInfo.ptrFind - v->ptr );
} }
return v; return v;
} ); }, "##allocations" );
} }
} }
ImGui::TreePop(); ImGui::TreePop();
@ -5220,7 +5220,7 @@ void View::DrawMemory()
ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) { ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) {
ImGui::Text( "0x%" PRIx64, (*v)->ptr ); ImGui::Text( "0x%" PRIx64, (*v)->ptr );
return *v; return *v;
} ); }, "##activeMem" );
ImGui::TreePop(); ImGui::TreePop();
} }

View File

@ -85,7 +85,7 @@ private:
void DrawCallstackWindow(); void DrawCallstackWindow();
template<class T> template<class T>
void ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress ); void ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress, const char* id = nullptr );
void DrawInfoWindow(); void DrawInfoWindow();
void DrawZoneInfoWindow(); void DrawZoneInfoWindow();