mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Do not use schematic object UUID comparisons when UUIDs are mutable.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19716
This commit is contained in:
parent
60c2469c75
commit
1dfe3ebc54
@ -442,11 +442,14 @@ int SCH_ITEM::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( m_Uuid < aOther.m_Uuid )
|
||||
return -1;
|
||||
if( isUuidImmutable() )
|
||||
{
|
||||
if( m_Uuid < aOther.m_Uuid )
|
||||
return -1;
|
||||
|
||||
if( m_Uuid > aOther.m_Uuid )
|
||||
return 1;
|
||||
if( m_Uuid > aOther.m_Uuid )
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -665,6 +665,19 @@ protected:
|
||||
|
||||
void getSymbolEditorMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
|
||||
|
||||
/**
|
||||
* Return the status of the #SCH_ITEM objects UUID immutability.
|
||||
*
|
||||
* This method is used by compare() to determine if the object's UUIDs should be compared.
|
||||
* Most #SCH_ITEM object UUIDs are created at run time an therefore should not be compared
|
||||
* so the default returns false. Override this method for #SCH_ITEM objects that have
|
||||
* immutable UUIDs.
|
||||
*
|
||||
* @retval true if the item's UUID is immutable.
|
||||
* @retval false if the item's UUID is not immutable.
|
||||
*/
|
||||
virtual bool isUuidImmutable() const { return false; }
|
||||
|
||||
/**
|
||||
* Provide the draw object specific comparison called by the == and < operators.
|
||||
*
|
||||
|
@ -1887,6 +1887,11 @@ wxString SCH_PIN::getItemDescription( ALT* aAlt ) const
|
||||
}
|
||||
|
||||
|
||||
bool SCH_PIN::isUuidImmutable() const
|
||||
{
|
||||
// SCH_SYMBOL pin UUIDs are immutable. LIB_SYMBOL pins UUIDs are not immutable.
|
||||
return ( static_cast<SCH_SYMBOL*>( GetParent() ) != nullptr );
|
||||
}
|
||||
|
||||
|
||||
int SCH_PIN::compare( const SCH_ITEM& aOther, int aCompareFlags ) const
|
||||
|
@ -333,6 +333,9 @@ protected:
|
||||
*/
|
||||
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPosition,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
|
||||
virtual bool isUuidImmutable() const override;
|
||||
|
||||
std::ostream& operator<<( std::ostream& aStream );
|
||||
|
||||
private:
|
||||
|
@ -208,6 +208,8 @@ public:
|
||||
std::vector<int> ViewGetLayers() const override;
|
||||
|
||||
protected:
|
||||
virtual bool isUuidImmutable() const override { return true; }
|
||||
|
||||
TRANSFORM m_transform; ///< The rotation/mirror transformation.
|
||||
|
||||
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to
|
||||
|
Loading…
x
Reference in New Issue
Block a user