Fix item data access in wxDataViewListCtrl.

Map items to rows correctly, just using wxPtrToUInt()-1 is not the right thing
to do if any items were deleted or changed.

Closes #14479.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-07-12 18:34:18 +00:00
parent 129342d84e
commit cc030eab72
2 changed files with 10 additions and 3 deletions

View File

@ -524,7 +524,14 @@ Major new features in this release
was added.
2.9.4: (release 2012-07-09)
2.9.5: (released ????-??-??)
All (GUI):
- Fix item data access in wxDataViewListCtrl (Kry).
2.9.4: (released 2012-07-09)
------
INCOMPATIBLE CHANGES SINCE 2.9.3

View File

@ -1768,7 +1768,7 @@ void wxDataViewListStore::DeleteAllItems()
void wxDataViewListStore::SetItemData( const wxDataViewItem& item, wxUIntPtr data )
{
wxDataViewListStoreLine* line = m_data[wxPtrToUInt( item.GetID() ) - 1];
wxDataViewListStoreLine* line = m_data[GetRow(item)];
if (!line) return;
line->SetData( data );
@ -1776,7 +1776,7 @@ void wxDataViewListStore::SetItemData( const wxDataViewItem& item, wxUIntPtr dat
wxUIntPtr wxDataViewListStore::GetItemData( const wxDataViewItem& item ) const
{
wxDataViewListStoreLine* line = m_data[wxPtrToUInt( item.GetID() ) - 1];
wxDataViewListStoreLine* line = m_data[GetRow(item)];
if (!line) return static_cast<wxUIntPtr>(NULL);
return line->GetData();