diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index e54bad0745..85d56eb2f5 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -602,7 +602,11 @@ wxSize wxToolBar::DoGetBestSize() const wxToolBarTool * const tool = static_cast(node->GetData()); - RECT rcItem = wxGetTBItemRect(GetHwnd(), toolIndex++); + // Note that we can't just reuse sizeTool here, even though all normal + // 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++); if ( IsVertical() ) {