Check for dirtied items in the cluster

When drawing the ratsnest, we need to be careful to avoid accessing
CONN_ITEMs that have been changed by the underlying model.  Checking for
dirty items instead of valid items will prevent us looking at data that
are out of date

Fixes https://gitlab.com/kicad/code/kicad/issues/14265

(cherry picked from commit 283770fc45)
This commit is contained in:
Seth Hillbrand 2023-03-13 16:06:24 -07:00
parent 7b4dd2f7f5
commit 9995b8714b
3 changed files with 9 additions and 1 deletions

View File

@ -290,7 +290,7 @@ void BOARD::UpdateRatsnestExclusions()
[&]( CN_EDGE& aEdge )
{
if( aEdge.GetSourceNode() && aEdge.GetTargetNode()
&& aEdge.GetSourceNode()->Valid() && aEdge.GetTargetNode()->Valid() )
&& !aEdge.GetSourceNode()->Dirty() && !aEdge.GetTargetNode()->Dirty() )
{
std::pair<KIID, KIID> ids = { aEdge.GetSourceNode()->Parent()->m_Uuid,
aEdge.GetTargetNode()->Parent()->m_Uuid };

View File

@ -275,6 +275,12 @@ bool CN_ANCHOR::Valid() const
}
bool CN_ANCHOR::Dirty() const
{
return !Valid() || m_item->Dirty();
}
bool CN_ANCHOR::IsDangling() const
{
int accuracy = 0;

View File

@ -72,6 +72,8 @@ public:
bool Valid() const;
bool Dirty() const;
CN_ITEM* Item() const
{
return m_item;