From d3f9332372565ef2f0ec5bc621e2d38bf32bfe57 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 11 Feb 2020 16:15:19 +0100 Subject: [PATCH] Kicad manager: Avoid crash when calling configure libraries from main menu, when _eeschema.kiface or _pcbnew.kiface is not found. Happen mainly when running Kicad from build tree. From master branch. --- kicad/mainframe.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 65868028ad..d6c69d0e36 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -574,15 +574,31 @@ void KICAD_MANAGER_FRAME::OnConfigurePaths( wxCommandEvent& aEvent ) void KICAD_MANAGER_FRAME::OnEditSymLibTable( wxCommandEvent& aEvent ) { - KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_SCH ); - kiface->CreateWindow( this, DIALOG_SCH_LIBRARY_TABLE, &Kiway() ); + try // _eeschema.kiface must be available: it contains the configure dialog. + { + KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_SCH ); + kiface->CreateWindow( this, DIALOG_SCH_LIBRARY_TABLE, &Kiway() ); + } + catch( ... ) + { + // Do nothing here. + // A error message is displayed after trying to load _pcbnew.kiface. + } } void KICAD_MANAGER_FRAME::OnEditFpLibTable( wxCommandEvent& aEvent ) { - KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB ); - kiface->CreateWindow( this, DIALOG_PCB_LIBRARY_TABLE, &Kiway() ); + try // _pcbnew.kiface must be available: it contains the configure dialog. + { + KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB ); + kiface->CreateWindow( this, DIALOG_PCB_LIBRARY_TABLE, &Kiway() ); + } + catch( ... ) + { + // Do nothing here. + // A error message is displayed after trying to load _pcbnew.kiface. + } }