From 5b7d29eae6a8c2eddba92678f625085c4c2dd3c7 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 1 Aug 2014 11:28:08 +0200 Subject: [PATCH] Fixed pcbnew crash when a locked footprint is dragged from an edge of the screen. --- common/view/wx_view_controls.cpp | 2 +- pcbnew/tools/edit_tool.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 5dc14ca1cf..848814e460 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -240,7 +240,7 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent ) #if wxCHECK_VERSION( 3, 0, 0 ) moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) ); moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) ); - moveEvent.SetAltDown( wxGetKeyState( WXK_ALT) ); + moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) ); #else // wx <3.0 do not have accessors, but the fields are exposed moveEvent.m_controlDown = wxGetKeyState( WXK_CONTROL ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 664f59a499..aefd8dd248 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -102,7 +102,6 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) PCB_BASE_EDIT_FRAME* editFrame = getEditFrame(); controls->ShowCursor( true ); controls->SetSnapping( true ); - controls->SetAutoPan( true ); controls->ForceCursorPosition( false ); // Main loop: keep receiving events @@ -159,7 +158,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) } else // Prepare to start dragging { - if( m_selectionTool->CheckLock() ) + if( m_selectionTool->CheckLock() || selection.Empty() ) break; // Save items, so changes can be undone @@ -188,6 +187,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) wxPoint( origin.x, origin.y ); } + controls->SetAutoPan( true ); m_dragging = true; }