Check that rows in wxDataViewListCtrl have the right size
Vectors passed to wxDataViewListCtrl::{Append,Insert,Prepend}Item() functions must have the correct, i.e. equal to the column count, number of items as otherwise accessing them later would result in a crash. Add checks verifying that this is indeed the case. Closes https://github.com/wxWidgets/wxWidgets/pull/724
This commit is contained in:
@@ -2209,6 +2209,7 @@ wxString wxDataViewListStore::GetColumnType( unsigned int pos ) const
|
||||
|
||||
void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxUIntPtr data )
|
||||
{
|
||||
wxCHECK_RET( values.size() == GetColumnCount(), "wrong number of values" );
|
||||
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
|
||||
line->m_values = values;
|
||||
m_data.push_back( line );
|
||||
@@ -2218,6 +2219,7 @@ void wxDataViewListStore::AppendItem( const wxVector<wxVariant> &values, wxUIntP
|
||||
|
||||
void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxUIntPtr data )
|
||||
{
|
||||
wxCHECK_RET( values.size() == GetColumnCount(), "wrong number of values" );
|
||||
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
|
||||
line->m_values = values;
|
||||
m_data.insert( m_data.begin(), line );
|
||||
@@ -2228,6 +2230,7 @@ void wxDataViewListStore::PrependItem( const wxVector<wxVariant> &values, wxUInt
|
||||
void wxDataViewListStore::InsertItem( unsigned int row, const wxVector<wxVariant> &values,
|
||||
wxUIntPtr data )
|
||||
{
|
||||
wxCHECK_RET( values.size() == GetColumnCount(), "wrong number of values" );
|
||||
wxDataViewListStoreLine *line = new wxDataViewListStoreLine( data );
|
||||
line->m_values = values;
|
||||
m_data.insert( m_data.begin()+row, line );
|
||||
|
Reference in New Issue
Block a user