Footprint editor: ensure the pad editor is closed before load a new footprint.
When editing a new footprint from the board editor, if the Footprint editor has the pad editor open, there is a risk of crash when replacing the footprint in edit. Fixes #6892 https://gitlab.com/kicad/code/kicad/issues/6892
This commit is contained in:
parent
82e728dbf6
commit
a6a2dae480
|
@ -135,6 +135,8 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
|
|||
m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ),
|
||||
m_thermalGap( aParent, m_thermalGapLabel, m_thermalGapCtrl, m_thermalGapUnits, true )
|
||||
{
|
||||
SetName( PAD_PROPERTIES_DLG_NAME );
|
||||
|
||||
m_currentPad = aPad; // aPad can be NULL, if the dialog is called
|
||||
// from the footprint editor to set default pad setup
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
* DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE,
|
||||
* created by wxFormBuilder
|
||||
*/
|
||||
// The wxWidgets window name. Used to retrieve the dialog by window name
|
||||
#define PAD_PROPERTIES_DLG_NAME "pad_properties_dlg_name"
|
||||
|
||||
class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -51,6 +51,7 @@ using namespace std::placeholders;
|
|||
#include <view/view_controls.h>
|
||||
#include <widgets/lib_tree.h>
|
||||
#include <widgets/progress_reporter.h>
|
||||
#include <dialog_pad_properties.h>
|
||||
|
||||
#include "fp_tree_model_adapter.h"
|
||||
|
||||
|
@ -98,6 +99,12 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint )
|
|||
if( aFootprint == NULL )
|
||||
return false;
|
||||
|
||||
// Ensure we do not have the pad editor open (that is apseudo modal dlg).
|
||||
// LoadFootprintFromBoard() can be called from the board editor, and we must ensure
|
||||
// no footprint item is currently in edit
|
||||
if( wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME ) )
|
||||
wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME )->Close();
|
||||
|
||||
if( !Clear_Pcb( true ) )
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue