diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 904294c968..68cd535490 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1419,10 +1419,10 @@ bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) wxHashTable attrsNew(wxKEY_INTEGER, 1000); for ( n = 0; n < count; n++ ) { - wxObject *attr = m_attrs.Delete(n); + wxObject *attr = m_attrs.Delete(aItems[n]); if ( attr ) { - attrsNew.Put(aItems[n], attr); + attrsNew.Put(n, attr); } }