Position interactive: add re-entrancy guard

This commit is contained in:
John Beard
2025-01-16 20:48:04 +08:00
parent e392b7b52d
commit a997dab769
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -84,7 +84,8 @@ static void positionRelativeClientSelectionFilter( const VECTOR2I& aPt,
POSITION_RELATIVE_TOOL::POSITION_RELATIVE_TOOL() :
PCB_TOOL_BASE( "pcbnew.PositionRelative" ),
m_dialog( nullptr ),
m_selectionTool( nullptr )
m_selectionTool( nullptr ),
m_inInteractivePosition( false )
{
}
@@ -158,6 +159,11 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent )
int POSITION_RELATIVE_TOOL::PositionRelativeInteractively( const TOOL_EVENT& aEvent )
{
if( m_inInteractivePosition )
return false;
REENTRANCY_GUARD guard( &m_inInteractivePosition );
// First, acquire the selection that we will be moving after
// we have the new offset vector.
const auto& selection = m_selectionTool->RequestSelection(
+1
View File
@@ -82,6 +82,7 @@ private:
PCB_SELECTION_TOOL* m_selectionTool;
PCB_SELECTION m_selection;
VECTOR2I m_selectionAnchor;
bool m_inInteractivePosition; // Re-entrancy guard
std::unique_ptr<BOARD_COMMIT> m_commit;
};