Eeschema: fix segfault when closing find dialog on dirty search cache. (fixes lp:1498997)
This commit is contained in:
parent
45a9b1c000
commit
dd41260c2c
|
@ -423,8 +423,27 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
SCH_SHEET_LIST schematic;
|
SCH_SHEET_LIST schematic;
|
||||||
SCH_FIND_COLLECTOR_DATA data;
|
SCH_FIND_COLLECTOR_DATA data;
|
||||||
|
SCH_FIND_REPLACE_DATA searchCriteria;
|
||||||
bool warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
|
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 )
|
if( m_foundItems.GetItem( data ) != NULL )
|
||||||
{
|
{
|
||||||
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText() );
|
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText() );
|
||||||
|
|
Loading…
Reference in New Issue