Be sure to stop the timer during widget destruction

Also fix a comment elsewhere :D

Fixes #8772
This commit is contained in:
Marek Roszko 2021-07-11 19:17:24 -04:00
parent 2889861c0b
commit 759f0e9a75
2 changed files with 7 additions and 4 deletions

View File

@ -157,6 +157,9 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable,
LIB_TREE::~LIB_TREE()
{
// Stop the timer during destruction early to avoid potential race conditions (that do happen)
m_debounceTimer->Stop();
// Save the column widths to the config file
m_adapter->SaveColWidths();

View File

@ -231,6 +231,10 @@ DIALOG_CHOOSE_SYMBOL::~DIALOG_CHOOSE_SYMBOL()
Unbind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Unbind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
// Stop the timer during destruction early to avoid potential race conditions (that do happen)
m_dbl_click_timer->Stop();
delete m_dbl_click_timer;
if( m_browser_button )
{
m_browser_button->Unbind( wxEVT_COMMAND_BUTTON_CLICKED,
@ -249,10 +253,6 @@ DIALOG_CHOOSE_SYMBOL::~DIALOG_CHOOSE_SYMBOL()
wxKeyEventHandler( DIALOG_CHOOSE_SYMBOL::OnCharHook ), NULL, this );
}
// I am not sure the following two lines are necessary, but they will not hurt anyone
m_dbl_click_timer->Stop();
delete m_dbl_click_timer;
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
{
cfg->m_SymChooserPanel.width = GetSize().x;