From dd374e12ad56d3cceeffe44c59bbe8674e3e6dc0 Mon Sep 17 00:00:00 2001 From: PJM Date: Sat, 22 Aug 2020 16:48:19 -0700 Subject: [PATCH] Pcbnew: Fix bug when mouse moves off clarification menu CHANGED: This code fixes an issue where bringing up the clarification menu and moving off it while keeping the button pressed the entire time caused an assertion. Fixes https://gitlab.com/kicad/code/kicad/issues/5250 --- pcbnew/tools/selection_tool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 2c1651a424..fa375007f3 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -281,8 +281,10 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( m_selection.Empty() && selectCursor() ) m_selection.SetIsHover( true ); - // Check if dragging has started within any of selected items bounding box - if( selectionContains( evt->Position() ) ) + // Check if dragging has started within any of selected items bounding box. + // We verify "HasPosition()" first to protect against edge case involving + // moving off menus that causes problems (issue #5250) + if( evt->HasPosition() && selectionContains( evt->Position() ) ) { // Yes -> run the move tool and wait till it finishes TRACK* track = dynamic_cast( m_selection.GetItem( 0 ) );