FOOTPRINT_SELECT_WIDGET: fix incorrect frame deletion, only noticeable when eeschema is run in stand alone mode.
After selecting a footprint using the footprint viewer, the application cannot be closed. Reason: the footprint viewer ctor creates an instance (not shown) of a FRAME_PCB. Unfortunately, this pcb frame was not deleted by Eeschema, in stand alone mode, preventing the application to be closed because a frame was still active after closing the schematic editor frame.
This commit is contained in:
parent
801e50450b
commit
6c083ebf4c
|
@ -202,6 +202,11 @@ wxString FOOTPRINT_SELECT_WIDGET::ShowPicker()
|
|||
// event loop goes all silly.
|
||||
wxASSERT( !dsparent || dsparent->IsQuasiModal() );
|
||||
|
||||
// Now open the footprint viewer.
|
||||
// However, this viewer creates a not shown PCB_EDIT_FRAME_NAME, if
|
||||
// it does not exist previously.
|
||||
// We must delete it when exiting, if it is not existing
|
||||
auto pcbframe = m_kiway->Player( FRAME_PCB, false ); // return nullptr if not yet existing.
|
||||
auto frame = m_kiway->Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
|
||||
|
||||
if( !frame->ShowModal( &fpname, parent ) )
|
||||
|
@ -211,6 +216,16 @@ wxString FOOTPRINT_SELECT_WIDGET::ShowPicker()
|
|||
|
||||
frame->Destroy();
|
||||
|
||||
// If the PCB_EDIT_FRAME was not previoulsy existing, delete the newly created one:
|
||||
if( !pcbframe )
|
||||
{
|
||||
pcbframe = m_kiway->Player( FRAME_PCB, false );
|
||||
|
||||
if( pcbframe )
|
||||
pcbframe->Destroy();
|
||||
}
|
||||
|
||||
|
||||
return fpname;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue