Make sure the board itself is in the item map.
Also makes closing the DRC dialog a bit more foolproof. Fixes https://gitlab.com/kicad/code/kicad/issues/5665
This commit is contained in:
parent
8dd725469f
commit
81b523f9a4
|
@ -55,11 +55,15 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, const std::map<KIID, EDA_ITEM*>&
|
|||
EDA_ITEM* mainItem = nullptr;
|
||||
EDA_ITEM* auxItem = nullptr;
|
||||
|
||||
if( m_mainItemUuid != niluuid )
|
||||
mainItem = aItemMap.at( m_mainItemUuid );
|
||||
auto ii = aItemMap.find( m_mainItemUuid );
|
||||
|
||||
if( m_auxItemUuid != niluuid )
|
||||
auxItem = aItemMap.at( m_auxItemUuid );
|
||||
if( ii != aItemMap.end() )
|
||||
mainItem = ii->second;
|
||||
|
||||
ii = aItemMap.find( m_auxItemUuid );
|
||||
|
||||
if( ii != aItemMap.end() )
|
||||
auxItem = ii->second;
|
||||
|
||||
if( mainItem && auxItem )
|
||||
{
|
||||
|
|
|
@ -802,6 +802,9 @@ BOARD_ITEM* BOARD::GetItem( const KIID& aID )
|
|||
|
||||
void BOARD::FillItemMap( std::map<KIID, EDA_ITEM*>& aMap )
|
||||
{
|
||||
// the board itself
|
||||
aMap[ this->m_Uuid ] = this;
|
||||
|
||||
for( TRACK* track : Tracks() )
|
||||
aMap[ track->m_Uuid ] = track;
|
||||
|
||||
|
|
|
@ -392,6 +392,12 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
||||
{
|
||||
// Close modeless dialogs
|
||||
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
|
||||
|
||||
if( open_dlg )
|
||||
open_dlg->Close( true );
|
||||
|
||||
// Shutdown all running tools
|
||||
if( m_toolManager )
|
||||
m_toolManager->ShutdownAllTools();
|
||||
|
@ -807,14 +813,6 @@ bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
return false;
|
||||
}
|
||||
|
||||
// First close the DRC dialog. For some reason, if the board editor frame is destroyed
|
||||
// when the DRC dialog currently open, Pcbnew crashes, at least on Windows.
|
||||
DIALOG_DRC* open_dlg = static_cast<DIALOG_DRC*>(
|
||||
wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME ) );
|
||||
|
||||
if( open_dlg )
|
||||
open_dlg->Close( true );
|
||||
|
||||
if( IsContentModified() )
|
||||
{
|
||||
wxFileName fileName = GetBoard()->GetFileName();
|
||||
|
@ -830,6 +828,13 @@ bool PCB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
// Close modeless dialogs. They're trouble when they get destroyed after the frame and/or
|
||||
// board.
|
||||
wxWindow* open_dlg = wxWindow::FindWindowByName( DIALOG_DRC_WINDOW_NAME );
|
||||
|
||||
if( open_dlg )
|
||||
open_dlg->Close( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue