From 0e8a72dbf08bb4be9ae79c5697a33ffd98422836 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Mon, 5 May 2014 23:58:33 -0500 Subject: [PATCH] Fix new bug which crashed pcbnew running under kicad.exe while adding a new module in mod editor --- pcbnew/moduleframe.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 076dc14999..cc83322f50 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -31,7 +31,7 @@ #include #include -//#include +#include #include #include #include @@ -50,7 +50,6 @@ #include #include #include -#include static PCB_SCREEN* s_screenModule; // the PCB_SCREEN used by the footprint editor @@ -296,7 +295,8 @@ BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const { // get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD. - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); + // @todo(DICK) change the routing to some default or the board directly, parent may not exist + PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); wxASSERT( parentFrame ); @@ -308,7 +308,8 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett { // set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD. - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); + // @todo(DICK) change the routing to some default or the board directly, parent may not exist + PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); wxASSERT( parentFrame ); @@ -320,7 +321,8 @@ const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const { // get the settings from the parent editor, not our BOARD. - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); + // @todo(DICK) change the routing to some default or the board directly, parent may not exist + PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); wxASSERT( parentFrame ); @@ -332,7 +334,8 @@ void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) { // set the settings into parent editor, not our BOARD. - PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent(); + // @todo(DICK) change the routing to some default or the board directly, parent may not exist + PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true ); wxASSERT( parentFrame );