Pcbnew: fix a crash when editing footprint properties and trying to open the footprint 3D properties.

This was due to a missing initialization of the dummy board color settings (used to draw the footprint in the 3D view).

Fixes: lp:1708712
https://bugs.launchpad.net/kicad/+bug/1708712
This commit is contained in:
jean-pierre charras 2017-08-05 16:37:51 +02:00
parent 7bf9f8e1c7
commit 2e96a5bc9f
4 changed files with 14 additions and 0 deletions

View File

@ -44,11 +44,21 @@
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager, PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
MODULE* aModuleCopy, MODULE* aModuleCopy,
COLORS_DESIGN_SETTINGS *aColors,
std::vector<S3D_INFO> *aParentInfoList ): std::vector<S3D_INFO> *aParentInfoList ):
PANEL_PREV_3D_BASE( aParent, wxID_ANY ) PANEL_PREV_3D_BASE( aParent, wxID_ANY )
{ {
initPanel(); initPanel();
// Initialize the color settings to draw the board and the footprint
if( aColors )
m_dummyBoard->SetColorsSettings( aColors );
else
{
static COLORS_DESIGN_SETTINGS defaultColors;
m_dummyBoard->SetColorsSettings( &defaultColors );
}
if( NULL != aCacheManager ) if( NULL != aCacheManager )
m_resolver = aCacheManager->GetResolver(); m_resolver = aCacheManager->GetResolver();

View File

@ -68,12 +68,14 @@ class S3D_FILENAME_RESOLVER;
class BOARD; class BOARD;
class CINFO3D_VISU; class CINFO3D_VISU;
class MODULE; class MODULE;
class COLORS_DESIGN_SETTINGS;
class PANEL_PREV_3D: public PANEL_PREV_3D_BASE class PANEL_PREV_3D: public PANEL_PREV_3D_BASE
{ {
public: public:
PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager, PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
MODULE* aModuleCopy, MODULE* aModuleCopy,
COLORS_DESIGN_SETTINGS *aColors,
std::vector<S3D_INFO> *aParentInfoList = NULL ); std::vector<S3D_INFO> *aParentInfoList = NULL );
~PANEL_PREV_3D(); ~PANEL_PREV_3D();

View File

@ -87,6 +87,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, m_PreviewPane = new PANEL_PREV_3D( m_Panel3D,
aParent->Prj().Get3DCacheManager(), aParent->Prj().Get3DCacheManager(),
m_currentModuleCopy, m_currentModuleCopy,
&aParent->Settings().Colors(),
&m_shapes3D_list ); &m_shapes3D_list );
bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 ); bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );

View File

@ -79,6 +79,7 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, m_PreviewPane = new PANEL_PREV_3D( m_Panel3D,
aParent->Prj().Get3DCacheManager(), aParent->Prj().Get3DCacheManager(),
m_currentModuleCopy, m_currentModuleCopy,
&aParent->Settings().Colors(),
&m_shapes3D_list ); &m_shapes3D_list );
bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 ); bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );