dyn_cast<PCB_TEXT*> won't find PCB_FIELDs.

We really should get rid of dyn_cast entirely....

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15052
This commit is contained in:
Jeff Young 2023-06-24 15:48:27 +01:00
parent 5195bc28fe
commit b3d7aea4df
3 changed files with 6 additions and 6 deletions

View File

@ -340,7 +340,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
bool DRC_TEST_PROVIDER::isInvisibleText( const BOARD_ITEM* aItem ) const
{
if( const PCB_TEXT* text = dyn_cast<const PCB_TEXT*>( aItem ) )
if( const PCB_TEXT* text = dynamic_cast<const PCB_TEXT*>( aItem ) )
{
if( !text->IsVisible() )
return true;

View File

@ -112,7 +112,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
const PCB_GROUP* group = dynamic_cast<const PCB_GROUP*>( item );
BOARD_ITEM* clone;
if( const PCB_FIELD* field = dyn_cast<const PCB_FIELD*>( item ) )
if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
{
if( field->IsMandatoryField() )
continue;
@ -148,7 +148,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
// only one is allowed. So add only non-mandatory fields.
bool can_add = true;
if( const PCB_FIELD* field = dyn_cast<const PCB_FIELD*>( item ) )
if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
{
if( field->IsMandatoryField() )
can_add = false;

View File

@ -2117,7 +2117,7 @@ PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
{
PCB_TEXT* candidate = dyn_cast<PCB_TEXT*>( item );
PCB_TEXT* candidate = dynamic_cast<PCB_TEXT*>( item );
if( candidate && candidate->GetText() == aRefItem->GetText() )
candidates.push_back( candidate );
@ -2258,7 +2258,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
for( BOARD_ITEM* item : aExisting->GraphicalItems() )
{
PCB_TEXT* srcItem = dyn_cast<PCB_TEXT*>( item );
PCB_TEXT* srcItem = dynamic_cast<PCB_TEXT*>( item );
if( srcItem )
{