Fix broken handling of closing ERC dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/6277
This commit is contained in:
Jeff Young 2020-11-04 01:07:46 +00:00
parent 5ede4061e3
commit 88abcc1287
3 changed files with 14 additions and 5 deletions

View File

@ -37,6 +37,7 @@
#include <sch_marker.h> #include <sch_marker.h>
#include <connection_graph.h> #include <connection_graph.h>
#include <tools/ee_actions.h> #include <tools/ee_actions.h>
#include <tools/ee_inspection_tool.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <dialog_erc.h> #include <dialog_erc.h>
#include <erc.h> #include <erc.h>
@ -228,7 +229,7 @@ void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& event )
{ {
m_parent->FocusOnItem( nullptr ); m_parent->FocusOnItem( nullptr );
Destroy(); m_parent->GetToolManager()->GetTool<EE_INSPECTION_TOOL>()->DestroyERCDialog();
} }

View File

@ -75,10 +75,7 @@ void EE_INSPECTION_TOOL::Reset( RESET_REASON aReason )
if( aReason == MODEL_RELOAD ) if( aReason == MODEL_RELOAD )
{ {
if( m_ercDialog ) DestroyERCDialog();
m_ercDialog->Destroy();
m_ercDialog = nullptr;
} }
} }
@ -111,6 +108,15 @@ int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent )
} }
void EE_INSPECTION_TOOL::DestroyERCDialog()
{
if( m_ercDialog )
m_ercDialog->Destroy();
m_ercDialog = nullptr;
}
// helper function to sort pins by pin num // helper function to sort pins by pin num
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst ) bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
{ {

View File

@ -47,6 +47,8 @@ public:
void Reset( RESET_REASON aReason ) override; void Reset( RESET_REASON aReason ) override;
int RunERC( const TOOL_EVENT& aEvent ); int RunERC( const TOOL_EVENT& aEvent );
void DestroyERCDialog();
int RunSimulation( const TOOL_EVENT& aEvent ); int RunSimulation( const TOOL_EVENT& aEvent );
int ShowDatasheet( const TOOL_EVENT& aEvent ); int ShowDatasheet( const TOOL_EVENT& aEvent );