Footprint editor: fix a crash when a graphic item is selected and the

measurement tool is active and closing the frame, or selecting a new footprint.
I am guessing it was a use after delete data.

Fixes #4302
https://gitlab.com/kicad/code/kicad/issues/4302
This commit is contained in:
jean-pierre charras 2020-05-03 09:02:15 +02:00
parent 4e217d4028
commit a152aa125b
1 changed files with 10 additions and 0 deletions

View File

@ -34,6 +34,8 @@
#include <pcbnew.h>
#include <footprint_edit_frame.h>
#include <tool/tool_manager.h>
#include "tools/pcb_actions.h"
bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
@ -41,6 +43,10 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
if( GetBoard() == NULL )
return false;
// Gal canvas: Ensure there are no selected items in selection list.
// (all items will be deleted):
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
if( aQuery && !GetBoard()->IsEmpty() )
{
if( !IsOK( this,
@ -99,6 +105,10 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery )
if( GetBoard() == NULL )
return false;
// Gal canvas: Ensure there are no selected items in selection list.
// (all items will be deleted):
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
if( aQuery && GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
{
wxSafeYield( this, true ); // Allow frame to come to front before showing warning.