]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
Swap client data pointers in wxRearrangeList too.
[wxWidgets.git] / src / generic / listctrl.cpp
index a59e9dc976cf644e118ab8e0721e3362816fcd4d..1efbc040eaeda8f6a2741d14ea5b9b749e0ee8f5 100644 (file)
@@ -4059,8 +4059,11 @@ void wxListMainWindow::InsertItem( wxListItem &item )
     {
         ResetVisibleLinesRange();
 
+        const unsigned col = item.GetColumn();
+        wxCHECK_RET( col < m_aColWidths.size(), "invalid item column" );
+
         // calculate the width of the item and adjust the max column width
-        wxColWidthInfo *pWidthInfo = m_aColWidths.Item(item.GetColumn());
+        wxColWidthInfo *pWidthInfo = m_aColWidths.Item(col);
         int width = GetItemWidthWithImage(&item);
         item.SetWidth(width);
         if (width > pWidthInfo->nMaxWidth)
@@ -4326,9 +4329,7 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
     {
         GetSizer()->Detach( m_headerWin );
 
-        delete m_headerWin;
-
-        m_headerWin = NULL;
+        wxDELETE(m_headerWin);
     }
 }