DIALOG_CHOOSE_COMPONENT: fix a crash when the option "footprint view" is activated.
The crash was due a not tested null pointer. Fixes: lp:1839282 https://bugs.launchpad.net/kicad/+bug/1839282
This commit is contained in:
parent
38fc51c3b6
commit
4e90b2d48b
|
@ -173,8 +173,10 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
|||
m_fp_sel_ctrl->Bind( EVT_FOOTPRINT_SELECTED,
|
||||
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
||||
|
||||
if( m_details )
|
||||
m_details->Connect( wxEVT_CHAR_HOOK,
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ), NULL, this );
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
|
||||
NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,8 +195,10 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
|
|||
m_fp_sel_ctrl->Unbind( EVT_FOOTPRINT_SELECTED,
|
||||
&DIALOG_CHOOSE_COMPONENT::OnFootprintSelected, this );
|
||||
|
||||
if( m_details )
|
||||
m_details->Disconnect( wxEVT_CHAR_HOOK,
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ), NULL, this );
|
||||
wxKeyEventHandler( DIALOG_CHOOSE_COMPONENT::OnCharHook ),
|
||||
NULL, this );
|
||||
|
||||
// I am not sure the following two lines are necessary, but they will not hurt anyone
|
||||
m_dbl_click_timer->Stop();
|
||||
|
@ -266,7 +270,8 @@ void DIALOG_CHOOSE_COMPONENT::OnInitDialog( wxInitDialogEvent& aEvent )
|
|||
|
||||
void DIALOG_CHOOSE_COMPONENT::OnCharHook( wxKeyEvent& e )
|
||||
{
|
||||
if( e.GetKeyCode() == 'C' && e.ControlDown() && !e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
|
||||
if( m_details && e.GetKeyCode() == 'C' && e.ControlDown() &&
|
||||
!e.AltDown() && !e.ShiftDown() && !e.MetaDown() )
|
||||
{
|
||||
wxString txt = m_details->SelectionToText();
|
||||
|
||||
|
|
Loading…
Reference in New Issue