Fixed a crash in Symbol Properties dialog

Fixes: lp:1802641
* https://bugs.launchpad.net/kicad/+bug/1802641
This commit is contained in:
Maciej Suminski 2018-11-13 14:01:51 +01:00
parent 436f80a0bb
commit 44424dcbb3
2 changed files with 10 additions and 2 deletions

View File

@ -492,6 +492,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
if( field.GetName() == fieldname.m_Name && field.GetText().IsEmpty() ) if( field.GetName() == fieldname.m_Name && field.GetText().IsEmpty() )
{ {
m_fields->erase( m_fields->begin() + i ); m_fields->erase( m_fields->begin() + i );
// grid needs to be notified about the size change,
// as it still accesses the data on close (size event)
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, i, 1 );
m_grid->ProcessTableMessage( msg );
i--; i--;
break; break;
} }

View File

@ -275,6 +275,7 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
template <class T> template <class T>
wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol ) wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
{ {
wxCHECK( aRow < GetNumberRows(), wxEmptyString );
const T& field = this->at( (size_t) aRow ); const T& field = this->at( (size_t) aRow );
switch( aCol ) switch( aCol )
@ -349,6 +350,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
template <class T> template <class T>
bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol ) bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
{ {
wxCHECK( aRow < GetNumberRows(), false );
const T& field = this->at( (size_t) aRow ); const T& field = this->at( (size_t) aRow );
switch( aCol ) switch( aCol )
@ -366,6 +368,7 @@ bool FIELDS_GRID_TABLE<T>::GetValueAsBool( int aRow, int aCol )
template <class T> template <class T>
void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue ) void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue )
{ {
wxCHECK( aRow < GetNumberRows(), /*void*/ );
T& field = this->at( (size_t) aRow ); T& field = this->at( (size_t) aRow );
wxPoint pos; wxPoint pos;
@ -432,9 +435,11 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
GetView()->Refresh(); GetView()->Refresh();
} }
template <class T> template <class T>
void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue ) void FIELDS_GRID_TABLE<T>::SetValueAsBool( int aRow, int aCol, bool aValue )
{ {
wxCHECK( aRow < GetNumberRows(), /*void*/ );
T& field = this->at( (size_t) aRow ); T& field = this->at( (size_t) aRow );
switch( aCol ) switch( aCol )
@ -503,5 +508,3 @@ void FIELDS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
GRID_TRICKS::doPopupSelection( event ); GRID_TRICKS::doPopupSelection( event );
} }
} }