mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Prevent assert (and access violation) in wxWidgets.
(It directly dereferences the ArrayString with the FilterIndex, without bounds checking it.)
This commit is contained in:
parent
82fd8623eb
commit
238719184e
@ -142,6 +142,11 @@ bool GERBVIEW_FRAME::LoadFileOrShowDialog( const wxString& aFileName,
|
|||||||
|
|
||||||
wxFileDialog dlg( this, dialogTitle, currentPath, filename.GetFullName(), dialogFiletypes,
|
wxFileDialog dlg( this, dialogTitle, currentPath, filename.GetFullName(), dialogFiletypes,
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
|
||||||
|
|
||||||
|
wxArrayString dummy1, dummy2;
|
||||||
|
const int nWildcards = wxParseCommonDialogsFilter( dialogFiletypes, dummy1, dummy2 );
|
||||||
|
|
||||||
|
if( lastGerberFileWildcard >= 0 && lastGerberFileWildcard < nWildcards )
|
||||||
dlg.SetFilterIndex( lastGerberFileWildcard );
|
dlg.SetFilterIndex( lastGerberFileWildcard );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
@ -114,6 +114,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString allWildcardsStr;
|
wxString allWildcardsStr;
|
||||||
|
|
||||||
for( const wxString& wildcard : allWildcardsSet )
|
for( const wxString& wildcard : allWildcardsSet )
|
||||||
allWildcardsStr << wildcard;
|
allWildcardsStr << wildcard;
|
||||||
|
|
||||||
@ -123,6 +124,10 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
|
|||||||
wxFileDialog dlg( this, _( "Import Footprint" ), m_mruPath, wxEmptyString, fileFiltersStr,
|
wxFileDialog dlg( this, _( "Import Footprint" ), m_mruPath, wxEmptyString, fileFiltersStr,
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
|
wxArrayString dummy1, dummy2;
|
||||||
|
const int nWildcards = wxParseCommonDialogsFilter( fileFiltersStr, dummy1, dummy2 );
|
||||||
|
|
||||||
|
if( lastFilterIndex >= 0 && lastFilterIndex < nWildcards )
|
||||||
dlg.SetFilterIndex( lastFilterIndex );
|
dlg.SetFilterIndex( lastFilterIndex );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user