Warn the search pane that pointers are going invalid

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16612
This commit is contained in:
Jon Evans 2024-01-18 17:50:50 -05:00
parent 693248f60f
commit f80094e7c5
4 changed files with 16 additions and 3 deletions

View File

@ -137,6 +137,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
return false;
}
wxCommandEvent e( EDA_EVT_SCHEMATIC_CHANGING );
ProcessEventLocally( e );
// unload current project file before loading new
{
ClearUndoRedoList();
@ -548,8 +551,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
UpdateHierarchyNavigator();
wxCommandEvent e( EDA_EVT_SCHEMATIC_CHANGED );
ProcessEventLocally( e );
wxCommandEvent changedEvt( EDA_EVT_SCHEMATIC_CHANGED );
ProcessEventLocally( changedEvt );
for( wxEvtHandler* listener : m_schematicChangeListeners )
{
@ -1315,6 +1318,9 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
SCH_SHEET_LIST sheetList = Schematic().GetSheets();
SCH_IO_MGR::SCH_FILE_T fileType = (SCH_IO_MGR::SCH_FILE_T) aFileType;
wxCommandEvent changingEvt( EDA_EVT_SCHEMATIC_CHANGING );
ProcessEventLocally( changingEvt );
switch( fileType )
{
case SCH_IO_MGR::SCH_ALTIUM:

View File

@ -118,6 +118,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, SCH_BASE_FRAME )
END_EVENT_TABLE()
wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
wxDEFINE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );

View File

@ -80,6 +80,7 @@ enum SCH_CLEANUP_FLAGS
};
wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGING, wxCommandEvent );
wxDECLARE_EVENT( EDA_EVT_SCHEMATIC_CHANGED, wxCommandEvent );

View File

@ -37,6 +37,11 @@ SCH_SEARCH_PANE::SCH_SEARCH_PANE( SCH_EDIT_FRAME* aFrame ) :
m_schFrame->Connect( EDA_EVT_SCHEMATIC_CHANGED,
wxCommandEventHandler( SCH_SEARCH_PANE::onSchChanged ), nullptr, this );
m_schFrame->Bind( EDA_EVT_SCHEMATIC_CHANGING, [&]( wxCommandEvent& )
{
ClearAllResults();
} );
wxFont infoFont = KIUI::GetDockedPaneFont( this );
SetFont( infoFont );
m_notebook->SetFont( infoFont );
@ -100,4 +105,4 @@ void SCH_SEARCH_PANE::OnSchItemsChanged( SCHEMATIC& aBoard, std::vector<SCH_ITEM
return;
RefreshSearch();
}
}