diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index b6def971f2..95862fb0eb 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -746,9 +746,15 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter ) void SCH_SCREEN::UpdateLocalLibSymbolLinks() { + std::vector symbols; + for( auto item : Items().OfType( SCH_COMPONENT_T ) ) + symbols.push_back( static_cast( item ) ); + + for( auto symbol : symbols ) { - SCH_COMPONENT* symbol = static_cast( item ); + // Changing the symbol may adjust the bbox of the symbol; remove and reinsert it afterwards. + m_rtree.remove( symbol ); auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() ); @@ -758,6 +764,8 @@ void SCH_SCREEN::UpdateLocalLibSymbolLinks() libSymbol = new LIB_PART( *it->second ); symbol->SetLibSymbol( libSymbol ); + + m_rtree.insert( symbol ); } }