mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
router: clean up shoved traces after aborting differential pair routing in shove mode
Note: the single-trace placer (LINE_PLACER) has moved to the FIXED_TAIL for tracking the interim placed routes (and reverting them if user pressed backspace). Unfortunately the DIFF_PAIR_PLACER didn't follow. The result was the dummy CommitPlacement() call at the end of aborted routing would commit the last shove state, even if FixRoute() was never called. For longer-term fix: fix ROUTER_TOOL logic to indicated aborted routing to the router/placer (AbortPlacement() is already there). Also implement FIXED_TAIL in diff pair placement mode.
This commit is contained in:
parent
8c017c7503
commit
ed6440b782
@ -642,6 +642,7 @@ bool DIFF_PAIR_PLACER::Start( const VECTOR2I& aP, ITEM* aStartItem )
|
|||||||
m_currentTraceOk = false;
|
m_currentTraceOk = false;
|
||||||
m_currentTrace = DIFF_PAIR();
|
m_currentTrace = DIFF_PAIR();
|
||||||
m_currentTrace.SetNets( m_netP, m_netN );
|
m_currentTrace.SetNets( m_netP, m_netN );
|
||||||
|
m_lastFixNode = nullptr;
|
||||||
|
|
||||||
initPlacement();
|
initPlacement();
|
||||||
|
|
||||||
@ -842,9 +843,15 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForce
|
|||||||
topo.SimplifyLine( &lineN );
|
topo.SimplifyLine( &lineN );
|
||||||
|
|
||||||
m_prevPair = m_currentTrace.EndingPrimitives();
|
m_prevPair = m_currentTrace.EndingPrimitives();
|
||||||
|
m_lastFixNode = m_lastNode;
|
||||||
|
|
||||||
|
// avoid an use-after-free error (CommitPlacement calls NODE::Commit which will invalidate the shove heads state. Need to rethink the memory management).
|
||||||
|
if( Settings().Mode() == RM_Shove )
|
||||||
|
m_shove = std::make_unique<SHOVE>( m_world, Router() );
|
||||||
|
|
||||||
CommitPlacement();
|
CommitPlacement();
|
||||||
m_placingVia = false;
|
m_placingVia = false;
|
||||||
|
m_lastFixNode = nullptr;
|
||||||
|
|
||||||
if( m_snapOnTarget || aForceFinish )
|
if( m_snapOnTarget || aForceFinish )
|
||||||
{
|
{
|
||||||
@ -862,6 +869,7 @@ bool DIFF_PAIR_PLACER::FixRoute( const VECTOR2I& aP, ITEM* aEndItem, bool aForce
|
|||||||
bool DIFF_PAIR_PLACER::AbortPlacement()
|
bool DIFF_PAIR_PLACER::AbortPlacement()
|
||||||
{
|
{
|
||||||
m_world->KillChildren();
|
m_world->KillChildren();
|
||||||
|
m_lastNode = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,9 +882,10 @@ bool DIFF_PAIR_PLACER::HasPlacedAnything() const
|
|||||||
|
|
||||||
bool DIFF_PAIR_PLACER::CommitPlacement()
|
bool DIFF_PAIR_PLACER::CommitPlacement()
|
||||||
{
|
{
|
||||||
if( m_lastNode )
|
if( m_lastFixNode )
|
||||||
Router()->CommitRouting( m_lastNode );
|
Router()->CommitRouting( m_lastFixNode );
|
||||||
|
|
||||||
|
m_lastFixNode = nullptr;
|
||||||
m_lastNode = nullptr;
|
m_lastNode = nullptr;
|
||||||
m_currentNode = nullptr;
|
m_currentNode = nullptr;
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,6 +249,7 @@ private:
|
|||||||
|
|
||||||
///< Postprocessed world state (including marked collisions & removed loops)
|
///< Postprocessed world state (including marked collisions & removed loops)
|
||||||
NODE* m_lastNode;
|
NODE* m_lastNode;
|
||||||
|
NODE* m_lastFixNode;
|
||||||
|
|
||||||
SIZES_SETTINGS m_sizes;
|
SIZES_SETTINGS m_sizes;
|
||||||
|
|
||||||
@ -277,6 +278,7 @@ private:
|
|||||||
ITEM* m_currentEndItem;
|
ITEM* m_currentEndItem;
|
||||||
|
|
||||||
bool m_idle;
|
bool m_idle;
|
||||||
|
bool m_hasFixedAnything;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user