Kicad manager: fix a very serious bug which crashes Kicad when running and closing gerbview, pcb_calculator, bitmap2component or pl_editor, when the Kicad manager frame is not the top level frame (It happens very easily if eeschema or pcbnew is running, after opening and closing a dialog).

Fix a few wxWidgets asserts.
menubar in pcbnew: move the recreate .cmp file menu to export menu, and fixes its help comment which was fully outdated.
This commit is contained in:
jean-pierre charras 2015-11-15 19:04:19 +01:00
parent 3e8b4503d1
commit d5aef07816
4 changed files with 19 additions and 10 deletions

View File

@ -216,7 +216,7 @@ void GRSetColorPen( wxDC* DC, EDA_COLOR_T Color, int width, wxPenStyle style )
wxColour wx_color = MakeColour( Color );
const wxPen& curr_pen = DC->GetPen();
if( curr_pen.GetColour() != wx_color
if( !curr_pen.IsOk() || curr_pen.GetColour() != wx_color
|| curr_pen.GetWidth() != width
|| curr_pen.GetStyle() != style )
{

View File

@ -6,7 +6,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 CERN (www.cern.ch)
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
@ -249,7 +249,17 @@ void KICAD_MANAGER_FRAME::TERMINATE_HANDLER::OnTerminate( int pid, int status )
wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ),
GetChars( appName ), pid );
( (KICAD_MANAGER_FRAME*) Pgm().App().GetTopWindow() )->PrintMsg( msg );
wxWindow* window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
if( window ) // Should always happen.
{
// Be sure the kicad frame manager is found
// This dynamic cast is not really mandatory, but ...
KICAD_MANAGER_FRAME* frame = dynamic_cast<KICAD_MANAGER_FRAME*> (window);
if( frame )
frame->PrintMsg( msg );
}
delete this;
}

View File

@ -149,12 +149,11 @@ void DIALOG_PLOT::Init_Dialog()
// Could devote a PlotOrder() function in place of UIOrder().
m_layerList = m_board->GetEnabledLayers().UIOrder();
// Populate the check list box by all enabled layers names
for( LSEQ seq = m_layerList; seq; ++seq )
{
LAYER_ID layer = *seq;
m_layerList.push_back( layer );
int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection()[layer] )

View File

@ -168,11 +168,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Generate IPC-D-356 netlist file" ),
KiBitmap( netlist_xpm ) );
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE,
_( "&Component (.cmp) File" ),
_( "(Re)create components file (*.cmp) for CvPcb" ),
KiBitmap( create_cmp_file_xpm ) );
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD,
_( "&BOM File" ),
_( "Create a bill of materials from schematic" ),
@ -222,6 +217,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "I&DFv3" ), _( "IDFv3 board and component export" ),
KiBitmap( export_idf_xpm ) );
AddMenuItem( submenuexport, ID_PCB_GEN_CMP_FILE,
_( "&Component (.cmp) File" ),
_( "Export component file (*.cmp) for Eeschema footprint field back-annotation" ),
KiBitmap( create_cmp_file_xpm ) );
AddMenuItem( filesMenu, submenuexport,
ID_GEN_EXPORT_FILE, _( "E&xport" ),
_( "Export board" ), KiBitmap( export_xpm ) );