Prevent crashes on invalid use of tools

See https://gitlab.com/kicad/code/kicad/-/issues/15085
This commit is contained in:
Jon Evans 2023-06-29 23:45:22 -04:00
parent 8fcd58038b
commit 2ae646136e
1 changed files with 3 additions and 0 deletions

View File

@ -663,6 +663,7 @@ void TOOL_MANAGER::RunMainStack( TOOL_BASE* aTool, std::function<void()> aFunc )
{
TOOL_STATE* st = m_toolState[aTool];
setActiveState( st );
wxCHECK( st->cofunc, /* void */ );
st->cofunc->RunMainStack( std::move( aFunc ) );
}
@ -678,6 +679,8 @@ TOOL_EVENT* TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool, const TOOL_EVENT_LIST&
st->pendingWait = true;
st->waitEvents = aConditions;
wxCHECK( st->cofunc, nullptr );
// switch context back to event dispatcher loop
st->cofunc->KiYield();