The user can cancel the opening of many editors.

Don't play dice with the devil.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17989

(cherry picked from commit a99377c1ec)
This commit is contained in:
Jeff Young
2024-05-09 23:36:32 +01:00
parent 1a932cb13b
commit cde18d7ae7
11 changed files with 172 additions and 148 deletions
+23 -13
View File
@@ -213,13 +213,15 @@ protected:
if( rawValue.IsEmpty() )
rawValue = m_preselect;
wxString symbolId = escapeLibId( rawValue );
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg );
wxString symbolId = escapeLibId( rawValue );
if( frame->ShowModal( &symbolId, m_dlg ) )
SetValue( UnescapeString( symbolId ) );
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_SYMBOL_CHOOSER, true, m_dlg ) )
{
if( frame->ShowModal( &symbolId, m_dlg ) )
SetValue( UnescapeString( symbolId ) );
frame->Destroy();
frame->Destroy();
}
}
DIALOG_SHIM* m_dlg;
@@ -267,18 +269,26 @@ protected:
if( fpid.IsEmpty() )
fpid = m_preselect;
KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg );
// Disable the button until we have finished processing it. Normally this is not an issue
// but if the footprint chooser is loading for the first time, it can be slow enough that
// multiple clicks will cause multiple instances of the footprint loader process to start
Disable();
if( !m_symbolNetlist.empty() )
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
{
KIWAY_EXPRESS event( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, m_symbolNetlist );
frame->KiwayMailIn( event );
if( !m_symbolNetlist.empty() )
{
KIWAY_EXPRESS event( FRAME_FOOTPRINT_CHOOSER, MAIL_SYMBOL_NETLIST, m_symbolNetlist );
frame->KiwayMailIn( event );
}
if( frame->ShowModal( &fpid, m_dlg ) )
SetValue( fpid );
frame->Destroy();
}
if( frame->ShowModal( &fpid, m_dlg ) )
SetValue( fpid );
frame->Destroy();
Enable();
}
protected: