Prevent segfault when running selection disambiguation menu.

This commit is contained in:
Jeff Young 2019-04-23 10:56:57 +01:00
parent ff6a8cd537
commit b6674e3bcb
2 changed files with 27 additions and 0 deletions

View File

@ -119,6 +119,11 @@ void SCH_BASE_FRAME::setupTools()
// Register tools
m_actions->RegisterAllTools( m_toolManager );
m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active
// JEY TODO: enable when we move event loop over to modern toolset...
//m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
}

View File

@ -433,6 +433,28 @@ bool SCH_SELECTION_TOOL::doSelectionMenu( SCH_COLLECTOR* aCollector, const wxStr
menu.SetIcon( info_xpm );
menu.DisplayTitle( true );
#if 1
// JEY TODO: use wxWidgets event loop for showing menu until we move over to modern toolset event loop
m_frame->GetCanvas()->SetAbortRequest( true ); // Changed to false if an item is selected
m_frame->PopupMenu( &menu );
if( m_frame->GetCanvas()->GetAbortRequest() )
{
m_frame->GetScreen()->SetCurItem( nullptr );
return false;
}
m_frame->GetCanvas()->MoveCursorToCrossHair();
current = m_frame->GetScreen()->GetCurItem();
toggleSelection( current );
aCollector->Empty();
aCollector->Append( current );
return true;
#endif
SetContextMenu( &menu, CMENU_NOW );
while( OPT_TOOL_EVENT evt = Wait() )