Don't crash when canceling graphics import

Grouped graphics need to have their group removed from the preview
before deleting the elements to avoid reading freed memory when
redrawing
This commit is contained in:
Seth Hillbrand 2022-11-23 16:20:12 -08:00
parent 16db0440ba
commit 47d86e5d9e
1 changed files with 6 additions and 0 deletions

View File

@ -1602,6 +1602,12 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
if( group )
{
preview.Remove( group );
group->RemoveAll();
}
for( BOARD_ITEM* item : newItems )
delete item;