From 5c3a56bdcc3fc50890afe6bb85d424495e3e9aff Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Sat, 13 Feb 2016 15:15:15 -0500 Subject: [PATCH] Fixed segfault in selection tool. (fixes lp:1542856) --- pcbnew/tools/selection_tool.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index dd5a8906d9..fb18e54575 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -313,9 +313,14 @@ const SELECTION& SELECTION_TOOL::GetSelection() BOARD_ITEM* item = m_selection.Item( i ); if( !modifiable( item ) ) + { m_selection.items.RemovePicker( i ); + m_selection.group->Remove( item ); + } else + { ++i; + } } return m_selection; @@ -746,6 +751,9 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent ) void SELECTION_TOOL::clearSelection() { + if( m_selection.Empty() ) + return; + KIGFX::VIEW_GROUP::const_iter it, it_end; // Restore the initial properties