Eeschema: fix segfault when closing find dialog on dirty search cache. (fixes lp:1498997)

This commit is contained in:
Wayne Stambaugh 2015-09-25 09:55:08 -04:00
parent 45a9b1c000
commit dd41260c2c
1 changed files with 19 additions and 0 deletions

View File

@ -423,8 +423,27 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
wxString msg;
SCH_SHEET_LIST schematic;
SCH_FIND_COLLECTOR_DATA data;
SCH_FIND_REPLACE_DATA searchCriteria;
bool warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
searchCriteria.SetFlags( aEvent.GetFlags() );
searchCriteria.SetFindString( aEvent.GetFindString() );
searchCriteria.SetReplaceString( aEvent.GetReplaceString() );
// Refresh the search cache in case something has changed. This prevents any stale
// pointers.
if( IsSearchCacheObsolete( searchCriteria ) )
{
if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
{
m_foundItems.Collect( searchCriteria, m_CurrentSheet );
}
else
{
m_foundItems.Collect( searchCriteria );
}
}
if( m_foundItems.GetItem( data ) != NULL )
{
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText() );