Correct usage signature for PNS_NODE::Add()
When moving a unique_ptr, you are actually passing the object, not a reference to the object. So we either std::move with the bare unique_ptr parameter or we pass a reference. But we should never pass an rvalue reference for this or we'll make a copy without holding the tracking (because it was moved) Fixes https://gitlab.com/kicad/code/kicad/-/issues/16839 (cherry picked from commitb2a25cb59e
) (cherry picked from commit38df918993
)
This commit is contained in:
parent
99ac73630a
commit
4d8269c5fd
|
@ -502,7 +502,7 @@ void NODE::addSolid( SOLID* aSolid )
|
|||
}
|
||||
|
||||
|
||||
void NODE::Add( std::unique_ptr< SOLID >&& aSolid )
|
||||
void NODE::Add( std::unique_ptr< SOLID > aSolid )
|
||||
{
|
||||
aSolid->SetOwner( this );
|
||||
addSolid( aSolid.release() );
|
||||
|
@ -537,7 +537,7 @@ void NODE::addHole( HOLE* aHole )
|
|||
}
|
||||
|
||||
|
||||
void NODE::Add( std::unique_ptr< VIA >&& aVia )
|
||||
void NODE::Add( std::unique_ptr< VIA > aVia )
|
||||
{
|
||||
addVia( aVia.release() );
|
||||
}
|
||||
|
@ -630,7 +630,7 @@ void NODE::addSegment( SEGMENT* aSeg )
|
|||
}
|
||||
|
||||
|
||||
bool NODE::Add( std::unique_ptr< SEGMENT >&& aSegment, bool aAllowRedundant )
|
||||
bool NODE::Add( std::unique_ptr< SEGMENT > aSegment, bool aAllowRedundant )
|
||||
{
|
||||
if( aSegment->Seg().A == aSegment->Seg().B )
|
||||
{
|
||||
|
@ -659,7 +659,7 @@ void NODE::addArc( ARC* aArc )
|
|||
}
|
||||
|
||||
|
||||
bool NODE::Add( std::unique_ptr< ARC >&& aArc, bool aAllowRedundant )
|
||||
bool NODE::Add( std::unique_ptr< ARC > aArc, bool aAllowRedundant )
|
||||
{
|
||||
const SHAPE_ARC& arc = aArc->CArc();
|
||||
|
||||
|
@ -811,7 +811,7 @@ void NODE::removeSolidIndex( SOLID* aSolid )
|
|||
}
|
||||
|
||||
|
||||
void NODE::Replace( ITEM* aOldItem, std::unique_ptr< ITEM >&& aNewItem )
|
||||
void NODE::Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem )
|
||||
{
|
||||
Remove( aOldItem );
|
||||
add( aNewItem.release() );
|
||||
|
|
|
@ -314,10 +314,10 @@ public:
|
|||
* at the same coordinates as an existing one).
|
||||
* @return true if added
|
||||
*/
|
||||
bool Add( std::unique_ptr< SEGMENT >&& aSegment, bool aAllowRedundant = false );
|
||||
void Add( std::unique_ptr< SOLID >&& aSolid );
|
||||
void Add( std::unique_ptr< VIA >&& aVia );
|
||||
bool Add( std::unique_ptr< ARC >&& aArc, bool aAllowRedundant = false );
|
||||
bool Add( std::unique_ptr<SEGMENT> aSegment, bool aAllowRedundant = false );
|
||||
void Add( std::unique_ptr<SOLID> aSolid );
|
||||
void Add( std::unique_ptr<VIA> aVia );
|
||||
bool Add( std::unique_ptr<ARC> aArc, bool aAllowRedundant = false );
|
||||
|
||||
void Add( LINE& aLine, bool aAllowRedundant = false );
|
||||
|
||||
|
@ -346,7 +346,7 @@ public:
|
|||
* @param aOldItem item to be removed
|
||||
* @param aNewItem item add instead
|
||||
*/
|
||||
void Replace( ITEM* aOldItem, std::unique_ptr< ITEM >&& aNewItem );
|
||||
void Replace( ITEM* aOldItem, std::unique_ptr< ITEM > aNewItem );
|
||||
void Replace( LINE& aOldLine, LINE& aNewLine );
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue