Use correct toolbar tool index when determining best size

Closes #18652.

Closes https://github.com/wxWidgets/wxWidgets/pull/1708
This commit is contained in:
Maarten Bent
2020-01-16 23:29:00 +01:00
committed by Vadim Zeitlin
parent 1ace3b336e
commit e700a02964

View File

@@ -597,7 +597,8 @@ wxSize wxToolBar::DoGetBestSize() const
wxToolBarToolsList::compatibility_iterator node;
int toolIndex = 0;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
for ( node = m_tools.GetFirst(); node; node = node->GetNext(),
toolIndex++ )
{
wxToolBarTool * const
tool = static_cast<wxToolBarTool *>(node->GetData());
@@ -621,7 +622,7 @@ wxSize wxToolBar::DoGetBestSize() const
// items do have this size, this is not true for the separators and it
// is both more robust and simpler to just always use TB_GETITEMRECT
// rather than handling the separators specially.
const RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex++);
const RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex);
if ( IsVertical() )
{