Add some defensive code to try and prevent freed pointer access.

Fixes https://gitlab.com/kicad/code/kicad/issues/5747
This commit is contained in:
Jeff Young 2020-10-03 18:48:07 +01:00
parent 81154c9270
commit 44b23dd3d1
1 changed files with 7 additions and 2 deletions

View File

@ -436,7 +436,11 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo
bool found = false;
if( m_view )
{
m_view->UnselectAll();
wxYield();
m_view->Freeze();
}
for( int i = m_rcItemsProvider->GetCount() - 1; i >= 0; --i )
{
@ -484,9 +488,10 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo
m_view->Select( ToItem( m_tree[ lastGood ] ) );
if( !aCurrentOnly )
{
m_rcItemsProvider->DeleteAllItems( aIncludeExclusions, aDeep );
}
if( m_view )
m_view->Thaw();
}