Don't assume an EDA_ITEM is a SCH_ITEM.

(It might in fact be a LIB_ITEM, which we don't put in
the RTree anyway.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14516
This commit is contained in:
Jeff Young 2023-04-11 15:25:11 +01:00
parent 11995c1350
commit cec4109176
1 changed files with 1 additions and 1 deletions

View File

@ -384,7 +384,7 @@ void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpda
* Be careful when calling this. Update will invalidate RTree iterators, so you cannot call this
* while doing things like `for( SCH_ITEM* item : screen->Items() )`
*/
if( aUpdateRtree)
if( aUpdateRtree && dynamic_cast<SCH_ITEM*>( aItem ) )
GetScreen()->Update( static_cast<SCH_ITEM*>( aItem ) );
// Calling Refresh() here introduces a bi-stable state: when doing operations on a