Browse Source

Don't update file browser filter if control doesn't exist

When the grid is being validated, SetValue is called, which then ends up
running the file filter update. However, if the cell was never selected,
the file browser button would never have been created.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16316
newinvert
Ian McInerney 2 years ago
parent
commit
d8bb9b1e66
  1. 8
      common/widgets/grid_text_button_helpers.cpp

8
common/widgets/grid_text_button_helpers.cpp

@ -508,8 +508,8 @@ void GRID_CELL_PATH_EDITOR::UpdateFilterString( const wxString& aFilterString )
m_fileFilter = aFilterString;
// Ensure that the control switches between files and directories properly
if( m_fileFilter.IsEmpty() )
static_cast<TEXT_BUTTON_FILE_BROWSER*>( m_control )->UpdateFileFilter( nullptr );
else
static_cast<TEXT_BUTTON_FILE_BROWSER*>( m_control )->UpdateFileFilter( &m_fileFilter );
TEXT_BUTTON_FILE_BROWSER* button = dynamic_cast<TEXT_BUTTON_FILE_BROWSER*>( m_control );
if( button )
button->UpdateFileFilter( m_fileFilter.IsEmpty() ? nullptr : &m_fileFilter );
}
Loading…
Cancel
Save