Fix double call of OnPgmExit

Also fix bad filename being passed to pcbnew when starting
from a blank schematic in standalone mode

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5786
This commit is contained in:
Jon Evans 2020-10-04 18:39:21 -04:00
parent 6c2433fed6
commit e27786de2d
3 changed files with 11 additions and 9 deletions

View File

@ -161,13 +161,7 @@ struct APP_SINGLE_TOP : public wxApp
try
{
if( !program.OnPgmInit() )
{
program.OnPgmExit();
return false;
}
return true;
return program.OnPgmInit();
}
catch( const std::exception& e )
{
@ -294,7 +288,11 @@ bool PGM_SINGLE_TOP::OnPgmInit()
#endif
if( !InitPgm() )
{
// Clean up
OnPgmExit();
return false;
}
#if !defined(BUILD_KIWAY_DLL)
@ -353,6 +351,8 @@ bool PGM_SINGLE_TOP::OnPgmInit()
if( appType == FRAME_T_COUNT )
{
wxLogError( wxT( "Unknown frame: %s" ), frameName );
// Clean up
OnPgmExit();
return false;
}
}

View File

@ -611,7 +611,7 @@ public:
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
bool IsConnectable() const override { return m_onBoard; }
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{

View File

@ -903,7 +903,7 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
{
wxFileName kicad_board = Prj().AbsolutePath( Schematic().GetFileName() );
if( kicad_board.IsOk() )
if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
{
kicad_board.SetExt( PcbFileExtension );
wxFileName legacy_board( kicad_board );
@ -940,6 +940,8 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
}
else
{
// If we are running inside a project, it should be impossible for this case to happen
wxASSERT( Kiface().IsSingle() );
ExecuteFile( this, PCBNEW_EXE );
}
}