Browse Source

Prevent crash with RTree modification invalidating iterator.

6.0.7
Jeff Young 4 years ago
parent
commit
0400c0a775
  1. 18
      eeschema/sch_edit_frame.cpp

18
eeschema/sch_edit_frame.cpp

@ -1366,18 +1366,22 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
bool show = Schematic().Settings().m_IntersheetRefsShow;
/* Refresh all global labels */
// Refresh all global labels. Note that we have to collect them first as the
// SCH_SCREEN::Update() call is going to invalidate the RTree iterator.
std::vector<SCH_GLOBALLABEL*> globalLabels;
for( EDA_ITEM* item : GetScreen()->Items().OfType( SCH_GLOBAL_LABEL_T ) )
{
SCH_GLOBALLABEL* gLabel = (SCH_GLOBALLABEL*)( item );
SCH_FIELD* intersheetRef = gLabel->GetIntersheetRefs();
globalLabels.push_back( static_cast<SCH_GLOBALLABEL*>( item ) );
intersheetRef->SetVisible( show );
for( SCH_GLOBALLABEL* globalLabel : globalLabels )
{
globalLabel->GetIntersheetRefs()->SetVisible( show );
if( show )
{
GetScreen()->Update( gLabel );
GetCanvas()->GetView()->Update( gLabel );
GetScreen()->Update( globalLabel );
GetCanvas()->GetView()->Update( globalLabel );
}
}
}

Loading…
Cancel
Save