Don't dereference board groups in fp editor
The Footprint editor group resolution should stop at the footprint level to avoid breaking into groups that cannot be accessed. Fixes https://gitlab.com/kicad/code/kicad/issues/7049
This commit is contained in:
parent
63e2046eb0
commit
740df93808
|
@ -89,10 +89,11 @@ public:
|
|||
/*
|
||||
* Searches for highest level group containing item.
|
||||
*
|
||||
* @param scope restricts the search to groups within the group scope.
|
||||
* @param aScope restricts the search to groups within the group scope.
|
||||
* @param aFootprintEditor true if we should stop promoting at the footprint level
|
||||
* @return group containing item, if it exists, otherwise, NULL
|
||||
*/
|
||||
static PCB_GROUP* TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope );
|
||||
static PCB_GROUP* TopLevelGroup( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool aFootprintEditor );
|
||||
|
||||
static bool WithinScope( BOARD_ITEM* item, PCB_GROUP* scope );
|
||||
|
||||
|
|
|
@ -69,17 +69,24 @@ void PCB_GROUP::RemoveAll()
|
|||
}
|
||||
|
||||
|
||||
PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* item, PCB_GROUP* scope )
|
||||
PCB_GROUP* PCB_GROUP::TopLevelGroup( BOARD_ITEM* aItem, PCB_GROUP* aScope, bool aFootprintEditor )
|
||||
{
|
||||
PCB_GROUP* candidate = item->GetParentGroup();
|
||||
PCB_GROUP* candidate = aItem->GetParentGroup();
|
||||
|
||||
if( !candidate && item->GetParent() && item->GetParent()->Type() == PCB_FOOTPRINT_T )
|
||||
candidate = item->GetParent()->GetParentGroup();
|
||||
// Don't get the footprint's group if we are in the footprint editor
|
||||
if( !candidate && aItem->GetParent() && aItem->GetParent()->Type() == PCB_FOOTPRINT_T
|
||||
&& !aFootprintEditor )
|
||||
candidate = aItem->GetParent()->GetParentGroup();
|
||||
|
||||
while( candidate && candidate->GetParentGroup() && candidate->GetParentGroup() != aScope )
|
||||
{
|
||||
if( candidate->GetParent()->Type() == PCB_FOOTPRINT_T && aFootprintEditor )
|
||||
break;
|
||||
|
||||
while( candidate && candidate->GetParentGroup() && candidate->GetParentGroup() != scope )
|
||||
candidate = candidate->GetParentGroup();
|
||||
}
|
||||
|
||||
return candidate == scope ? nullptr : candidate;
|
||||
return candidate == aScope ? nullptr : candidate;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2497,7 +2497,7 @@ void PCB_SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector
|
|||
continue;
|
||||
}
|
||||
|
||||
PCB_GROUP* aTop = PCB_GROUP::TopLevelGroup( item, m_enteredGroup );
|
||||
PCB_GROUP* aTop = PCB_GROUP::TopLevelGroup( item, m_enteredGroup, m_isFootprintEditor );
|
||||
|
||||
if( aTop )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue