pcbnew: Fix crash in find dialog

Tool manager is not exposed to the dialogs, we need to reference it
through the parent frame.

Fixes: lp:1830942
* https://bugs.launchpad.net/kicad/+bug/1830942
This commit is contained in:
Seth Hillbrand 2019-05-29 12:04:45 -07:00
parent 48899a4c96
commit 218bea9ace
1 changed files with 5 additions and 4 deletions

View File

@ -85,7 +85,8 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
PCB_SCREEN* screen = parent->GetScreen();
wxPoint pos;
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
wxString searchString = m_SearchTextCtrl->GetValue();
if( !searchString.IsSameAs( prevSearchString, false ) )
@ -133,7 +134,7 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
if( foundItem )
{
GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem );
parent->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem );
parent->FocusOnLocation( pos, !m_NoMouseWarpCheckBox->IsChecked(), true );
msg.Printf( _( "\"%s\" found" ), GetChars( searchString ) );
parent->SetStatusText( msg );
@ -157,7 +158,7 @@ void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
wxPoint pos;
foundItem = NULL;
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
parent->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
MARKER_PCB* marker = parent->GetBoard()->GetMARKER( markerCount++ );
@ -171,7 +172,7 @@ void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
wxString msg;
if( foundItem )
{
GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem );
parent->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, foundItem );
parent->FocusOnLocation( pos, !m_NoMouseWarpCheckBox->IsChecked() );
msg = _( "Marker found" );
parent->SetStatusText( msg );