Fix crash when moving empty selection
Need to pop the move tool when exiting, even at the beginning Fixes https://gitlab.com/kicad/code/kicad/issues/13114
This commit is contained in:
parent
c07043e762
commit
ee05b67599
|
@ -738,6 +738,9 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe
|
||||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||||
VECTOR2I originalCursorPos = controls->GetCursorPosition();
|
VECTOR2I originalCursorPos = controls->GetCursorPosition();
|
||||||
|
|
||||||
|
std::string tool = aEvent.GetCommandStr().get();
|
||||||
|
editFrame->PushTool( tool );
|
||||||
|
|
||||||
// Be sure that there is at least one item that we can modify. If nothing was selected before,
|
// Be sure that there is at least one item that we can modify. If nothing was selected before,
|
||||||
// try looking for the stuff under mouse cursor (i.e. KiCad old-style hover selection)
|
// try looking for the stuff under mouse cursor (i.e. KiCad old-style hover selection)
|
||||||
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
|
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
|
||||||
|
@ -751,7 +754,10 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe
|
||||||
frame()->Settings().m_AllowFreePads && !m_isFootprintEditor );
|
frame()->Settings().m_AllowFreePads && !m_isFootprintEditor );
|
||||||
|
|
||||||
if( m_dragging || selection.Empty() )
|
if( m_dragging || selection.Empty() )
|
||||||
|
{
|
||||||
|
editFrame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
LSET item_layers = selection.GetSelectionLayers();
|
LSET item_layers = selection.GetSelectionLayers();
|
||||||
bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call
|
bool is_hover = selection.IsHover(); // N.B. This must be saved before the second call
|
||||||
|
@ -777,10 +783,10 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference, bool aRe
|
||||||
}
|
}
|
||||||
|
|
||||||
if( selection.Empty() )
|
if( selection.Empty() )
|
||||||
|
{
|
||||||
|
editFrame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
std::string tool = aEvent.GetCommandStr().get();
|
|
||||||
editFrame->PushTool( tool );
|
|
||||||
|
|
||||||
Activate();
|
Activate();
|
||||||
// Must be done after Activate() so that it gets set into the correct context
|
// Must be done after Activate() so that it gets set into the correct context
|
||||||
|
|
Loading…
Reference in New Issue