From 3f0bfc200de9b3a1cf5041485bd180ccffb6419d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 Mar 2007 23:29:03 +0000 Subject: [PATCH] fix wrong assert in SetItemBitmap() (patch 1668449; bug 1667505) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44665 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/bmpcboxg.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generic/bmpcboxg.cpp b/src/generic/bmpcboxg.cpp index 3432680bd6..211e94dd30 100644 --- a/src/generic/bmpcboxg.cpp +++ b/src/generic/bmpcboxg.cpp @@ -146,6 +146,9 @@ bool wxBitmapComboBox::Create(wxWindow *parent, void wxBitmapComboBox::PostCreate() { m_fontHeight = GetCharHeight() + EXTRA_FONT_HEIGHT; + + while ( m_bitmaps.GetCount() < GetCount() ) + m_bitmaps.Add( new wxBitmap() ); } wxBitmapComboBox::~wxBitmapComboBox() @@ -159,7 +162,7 @@ wxBitmapComboBox::~wxBitmapComboBox() void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap) { - wxCHECK_RET( n < m_bitmaps.size(), wxT("invalid item index") ); + wxCHECK_RET( n < GetCount(), wxT("invalid item index") ); OnAddBitmap(bitmap); *GetBitmapPtr(n) = bitmap; @@ -169,7 +172,7 @@ void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const { - wxCHECK_MSG( n < m_bitmaps.size(), wxNullBitmap, wxT("invalid item index") ); + wxCHECK_MSG( n < GetCount(), wxNullBitmap, wxT("invalid item index") ); return *GetBitmapPtr(n); }