Commit aaabdeae authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix crash after opening footprint wizard

parent a3ea46d0
...@@ -51,15 +51,15 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -51,15 +51,15 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
/* Function OnLeftClick /* Function OnLeftClick
* Captures a left click event in the dialog * Captures a left click event in the dialog
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void FOOTPRINT_WIZARD_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
} }
/* Function OnRightClick /* Function OnRightClick
* Captures a right click event in the dialog * Captures a right click event in the dialog
* *
*/ */
bool FOOTPRINT_WIZARD_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) bool FOOTPRINT_WIZARD_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
{ {
...@@ -87,6 +87,9 @@ void FOOTPRINT_WIZARD_FRAME::DisplayWizardInfos() ...@@ -87,6 +87,9 @@ void FOOTPRINT_WIZARD_FRAME::DisplayWizardInfos()
void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
{ {
if( m_FootprintWizard == NULL )
return;
SetCurItem( NULL ); SetCurItem( NULL );
// Delete the current footprint // Delete the current footprint
GetBoard()->m_Modules.DeleteAll(); GetBoard()->m_Modules.DeleteAll();
...@@ -108,11 +111,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() ...@@ -108,11 +111,11 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
{ {
DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard = DIALOG_FOOTPRINT_WIZARD_LIST *selectWizard =
new DIALOG_FOOTPRINT_WIZARD_LIST(this); new DIALOG_FOOTPRINT_WIZARD_LIST(this);
selectWizard->ShowModal(); selectWizard->ShowModal();
m_FootprintWizard = selectWizard->GetWizard(); m_FootprintWizard = selectWizard->GetWizard();
if (m_FootprintWizard) if (m_FootprintWizard)
...@@ -131,9 +134,9 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard() ...@@ -131,9 +134,9 @@ void FOOTPRINT_WIZARD_FRAME::SelectFootprintWizard()
void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event )
{ {
SelectFootprintWizard(); SelectFootprintWizard();
} }
/** /**
...@@ -142,26 +145,26 @@ void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event ) ...@@ -142,26 +145,26 @@ void FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard( wxCommandEvent& event )
*/ */
void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
{ {
int page = m_PageList->GetSelection(); int page = m_PageList->GetSelection();
if (page<0) if (page<0)
return; return;
int n=m_ParameterGrid->GetNumberRows(); int n=m_ParameterGrid->GetNumberRows();
wxArrayString arr; wxArrayString arr;
for (int i=0;i<n;i++) for (int i=0;i<n;i++)
{ {
wxString val = m_ParameterGrid->GetCellValue(i,1); wxString val = m_ParameterGrid->GetCellValue(i,1);
arr.Add(val); arr.Add(val);
} }
wxString res = m_FootprintWizard->SetParameterValues(page,arr); wxString res = m_FootprintWizard->SetParameterValues(page,arr);
ReloadFootprint(); ReloadFootprint();
DisplayWizardInfos(); DisplayWizardInfos();
} }
...@@ -169,7 +172,7 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event ) ...@@ -169,7 +172,7 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
* Function RedrawActiveWindow * Function RedrawActiveWindow
* Display the current selected component. * Display the current selected component.
* If the component is an alias, the ROOT component is displayed * If the component is an alias, the ROOT component is displayed
* *
*/ */
void FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) void FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment