From: Vadim Zeitlin Date: Sun, 30 Oct 2011 14:19:47 +0000 (+0000) Subject: Fix assert in generic wxListCtrl icon view when using images. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7e132bdd475e64060c8c5744aa376420aa530bac 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 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 9faacbc8c8..5d4767f939 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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;