Fix assert in generic wxListCtrl icon view when using images.

Don't assume that the item image is a valid index in m_small_image_list as we
may be in icon view which doesn't use small images at all.

For now restrict this code to the report view mode as apparently the cached
line height is not supposed to be used in other modes even though it's not
clear whether this is really the case and so, perhaps, this code should also
be used when in small icons view mode.

Closes #13604.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-10-30 14:19:47 +00:00
parent dabf7342ef
commit 7e132bdd47

View File

@@ -4027,14 +4027,14 @@ void wxListMainWindow::InsertItem( wxListItem &item )
wxListLineData *line = new wxListLineData(this);
line->SetItem( item.m_col, item );
if ((item.m_mask & wxLIST_MASK_IMAGE) && item.GetImage() != -1)
if ( item.m_mask & wxLIST_MASK_IMAGE )
{
// Reset the buffered height if it's not big enough for the new image.
if (m_small_image_list)
int image = item.GetImage();
if ( m_small_image_list && image != -1 && InReportView() )
{
int imageWidth, imageHeight;
m_small_image_list->GetSize(item.GetImage(),
imageWidth, imageHeight);
m_small_image_list->GetSize(image, imageWidth, imageHeight);
if ( imageHeight > m_lineHeight )
m_lineHeight = 0;