Fix symbol editor crash when modifying fields while a field is selected

Field Editor dialog calls LIB_EDIT::SetFields() that deletes the old
LIB_FIELD objects and creates new ones. If any of the old LIB_FIELD
objects had been selected before invoking the dialog, then one of the
update UI event handlers will crash trying to access the object.
This commit is contained in:
Maciej Suminski 2018-03-31 13:31:49 +02:00
parent 0171547154
commit dd56f16776
1 changed files with 3 additions and 0 deletions

View File

@ -158,6 +158,9 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, GetCurPart() );
if( GetDrawItem() && GetDrawItem()->Type() == LIB_FIELD_T )
SetDrawItem( nullptr ); // selected LIB_FIELD might be deleted
// This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
// frame. Therefore this dialog as a modal frame parent, MUST be run under
// quasimodal mode for the quasimodal frame support to work. So don't use