Check pointer after yield

Yielding can change the status of the m_rcItemsProvider, so we need to
check after the yield to ensure we don't try to dereference it after
freeing

Fixes https://gitlab.com/kicad/code/kicad/issues/11347
This commit is contained in:
Seth Hillbrand 2022-04-06 15:58:16 -07:00
parent 356d565d48
commit 91a3024e34
1 changed files with 3 additions and 3 deletions

View File

@ -485,9 +485,6 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo
return; return;
} }
if( !m_rcItemsProvider )
return;
int lastGood = -1; int lastGood = -1;
bool itemDeleted = false; bool itemDeleted = false;
@ -498,6 +495,9 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo
m_view->Freeze(); m_view->Freeze();
} }
if( !m_rcItemsProvider )
return;
for( int i = m_rcItemsProvider->GetCount( m_severities ) - 1; i >= 0; --i ) for( int i = m_rcItemsProvider->GetCount( m_severities ) - 1; i >= 0; --i )
{ {
std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i ); std::shared_ptr<RC_ITEM> rcItem = m_rcItemsProvider->GetItem( i );